fix: sửa lỗi tách bảng điều khiển TCP

This commit is contained in:
2026-07-18 21:31:57 +07:00
parent f52e9b7bef
commit 50bb87d50a
2 changed files with 158 additions and 20 deletions
+25 -20
View File
@@ -748,7 +748,14 @@
fadeOutMs: 0,
});
const timelineWrapperRef = useRef(null);
const timelineWrapperRef = useRef(null);
const tcpContainerRef = useRef(null);
const handleTimelineScroll = (e) => {
if (tcpContainerRef.current) {
tcpContainerRef.current.scrollTop = e.currentTarget.scrollTop;
}
};
const rulerRef = useRef(null);
const activeSourcesRef = useRef([]);
const startOffsetTimeRef = useRef(0);
@@ -1417,11 +1424,9 @@
});
return newZoom;
});
} else {
} else if (e.shiftKey) {
e.preventDefault();
// Horizontal scroll
const dir = e.deltaY > 0 ? 1 : -1;
timeline.scrollLeft += dir * 60;
timeline.scrollLeft += e.deltaY;
}
};
@@ -1680,7 +1685,7 @@
const rect = wrapper.getBoundingClientRect();
const scrollLeft = wrapper.scrollLeft;
const mouseX = e.clientX - rect.left + scrollLeft;
const time = Math.max(0, Math.min(maxDuration, (mouseX - 300) / zoom));
const time = Math.max(0, Math.min(maxDuration, mouseX / zoom));
setLocalSelectionEnd(time);
};
const handleMouseUp = () => {
@@ -1731,20 +1736,20 @@
});
};
useEffect(() => {
const handleMouseMove = (e) => {
const drag = draggedClipRef.current;
if (!drag) return;
const wrapper = timelineWrapperRef.current;
if (!wrapper) return;
const rect = wrapper.getBoundingClientRect();
const scrollLeft = wrapper.scrollLeft;
const mouseX = e.clientX - rect.left + scrollLeft;
const time = (mouseX - 300) / zoom;
const rawStart = Math.max(0, time - drag.clickOffset);
const newStart = snapTime(rawStart, snapValueRef.current, bpmRef.current);
useEffect(() => {
const handleMouseMove = (e) => {
const drag = draggedClipRef.current;
if (!drag) return;
const wrapper = timelineWrapperRef.current;
if (!wrapper) return;
const rect = wrapper.getBoundingClientRect();
const scrollLeft = wrapper.scrollLeft;
const mouseX = e.clientX - rect.left + scrollLeft;
const time = mouseX / zoom;
const rawStart = Math.max(0, time - drag.clickOffset);
const newStart = snapTime(rawStart, snapValueRef.current, bpmRef.current);
const targetTrackId = hoveredTrackIdRef.current || drag.trackId;