fix:lỗi drag ở vị trí con trỏ
This commit is contained in:
@@ -1614,12 +1614,11 @@
|
||||
};
|
||||
|
||||
const handleRulerMouseDown = (e) => {
|
||||
const ruler = rulerRef.current;
|
||||
if (!ruler) return;
|
||||
const rect = ruler.getBoundingClientRect();
|
||||
const wrapper = timelineWrapperRef.current;
|
||||
const scrollLeft = wrapper ? wrapper.scrollLeft : 0;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft;
|
||||
if (!wrapper) return;
|
||||
const rect = wrapper.getBoundingClientRect();
|
||||
const scrollLeft = wrapper.scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft - 300;
|
||||
const time = mouseX / zoom;
|
||||
|
||||
clearLocalSelection();
|
||||
@@ -1635,12 +1634,11 @@
|
||||
useEffect(() => {
|
||||
const handleMouseMove = (e) => {
|
||||
if (!isDraggingRulerRef.current) return;
|
||||
const ruler = rulerRef.current;
|
||||
const wrapper = timelineWrapperRef.current;
|
||||
if (!ruler || !wrapper) return;
|
||||
const rect = ruler.getBoundingClientRect();
|
||||
if (!wrapper) return;
|
||||
const rect = wrapper.getBoundingClientRect();
|
||||
const scrollLeft = wrapper.scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft - 300;
|
||||
const time = Math.max(0, Math.min(maxDuration, mouseX / zoom));
|
||||
|
||||
setSelectionEnd(time);
|
||||
@@ -1684,7 +1682,7 @@
|
||||
if (!wrapper) return;
|
||||
const rect = wrapper.getBoundingClientRect();
|
||||
const scrollLeft = wrapper.scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft - 300;
|
||||
const time = Math.max(0, Math.min(maxDuration, mouseX / zoom));
|
||||
setLocalSelectionEnd(time);
|
||||
};
|
||||
@@ -1785,7 +1783,7 @@
|
||||
|
||||
const rect = wrapper.getBoundingClientRect();
|
||||
const scrollLeft = wrapper.scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft;
|
||||
const mouseX = e.clientX - rect.left + scrollLeft - 300;
|
||||
const time = mouseX / zoom;
|
||||
const rawStart = Math.max(0, time - drag.clickOffset);
|
||||
const newStart = snapTime(rawStart, snapValueRef.current, bpmRef.current);
|
||||
|
||||
Reference in New Issue
Block a user