mirror of
https://github.com/OpenCut-app/OpenCut.git
synced 2026-07-13 21:52:53 +02:00
fix: remaining timeline issues with targeting wrong radix ui scroll element
This commit is contained in:
@@ -28,9 +28,7 @@ export function SnapIndicator({
|
|||||||
|
|
||||||
// Track scroll position to lock snap indicator to frame
|
// Track scroll position to lock snap indicator to frame
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const tracksViewport = tracksScrollRef.current?.querySelector(
|
const tracksViewport = tracksScrollRef.current;
|
||||||
"[data-radix-scroll-area-viewport]"
|
|
||||||
) as HTMLElement;
|
|
||||||
|
|
||||||
if (!tracksViewport) return;
|
if (!tracksViewport) return;
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,7 @@ export function TimelinePlayhead({
|
|||||||
|
|
||||||
// Track scroll position to lock playhead to frame
|
// Track scroll position to lock playhead to frame
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const tracksViewport = tracksScrollRef.current?.querySelector(
|
const tracksViewport = tracksScrollRef.current;
|
||||||
"[data-radix-scroll-area-viewport]"
|
|
||||||
) as HTMLElement;
|
|
||||||
|
|
||||||
if (!tracksViewport) return;
|
if (!tracksViewport) return;
|
||||||
|
|
||||||
@@ -86,9 +84,7 @@ export function TimelinePlayhead({
|
|||||||
// Get the timeline content width and viewport width for right boundary
|
// Get the timeline content width and viewport width for right boundary
|
||||||
const timelineContentWidth =
|
const timelineContentWidth =
|
||||||
duration * TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel;
|
duration * TIMELINE_CONSTANTS.PIXELS_PER_SECOND * zoomLevel;
|
||||||
const tracksViewport = tracksScrollRef.current?.querySelector(
|
const tracksViewport = tracksScrollRef.current;
|
||||||
"[data-radix-scroll-area-viewport]"
|
|
||||||
) as HTMLElement;
|
|
||||||
const viewportWidth = tracksViewport?.clientWidth || 1000;
|
const viewportWidth = tracksViewport?.clientWidth || 1000;
|
||||||
|
|
||||||
// Constrain playhead to never appear outside the timeline area
|
// Constrain playhead to never appear outside the timeline area
|
||||||
|
|||||||
@@ -119,12 +119,8 @@ export function useTimelinePlayhead({
|
|||||||
|
|
||||||
// Auto-scroll function during dragging
|
// Auto-scroll function during dragging
|
||||||
const performAutoScroll = useCallback(() => {
|
const performAutoScroll = useCallback(() => {
|
||||||
const rulerViewport = rulerScrollRef.current?.querySelector(
|
const rulerViewport = rulerScrollRef.current;
|
||||||
"[data-radix-scroll-area-viewport]"
|
const tracksViewport = tracksScrollRef.current;
|
||||||
) as HTMLElement;
|
|
||||||
const tracksViewport = tracksScrollRef.current?.querySelector(
|
|
||||||
"[data-radix-scroll-area-viewport]"
|
|
||||||
) as HTMLElement;
|
|
||||||
|
|
||||||
if (!rulerViewport || !tracksViewport || !isScrubbing) return;
|
if (!rulerViewport || !tracksViewport || !isScrubbing) return;
|
||||||
|
|
||||||
@@ -240,12 +236,8 @@ export function useTimelinePlayhead({
|
|||||||
// Only auto-scroll during playback, not during manual interactions
|
// Only auto-scroll during playback, not during manual interactions
|
||||||
if (!isPlaying || isScrubbing) return;
|
if (!isPlaying || isScrubbing) return;
|
||||||
|
|
||||||
const rulerViewport = rulerScrollRef.current?.querySelector(
|
const rulerViewport = rulerScrollRef.current;
|
||||||
"[data-radix-scroll-area-viewport]"
|
const tracksViewport = tracksScrollRef.current;
|
||||||
) as HTMLElement;
|
|
||||||
const tracksViewport = tracksScrollRef.current?.querySelector(
|
|
||||||
"[data-radix-scroll-area-viewport]"
|
|
||||||
) as HTMLElement;
|
|
||||||
if (!rulerViewport || !tracksViewport) return;
|
if (!rulerViewport || !tracksViewport) return;
|
||||||
|
|
||||||
const playheadPx = playheadPosition * 50 * zoomLevel; // TIMELINE_CONSTANTS.PIXELS_PER_SECOND = 50
|
const playheadPx = playheadPosition * 50 * zoomLevel; // TIMELINE_CONSTANTS.PIXELS_PER_SECOND = 50
|
||||||
|
|||||||
Reference in New Issue
Block a user