🎥 Make videos programmatically with React
Fix left timeline layer double-clicks
Jonny Burger11d32eaba787
diff --git a/packages/example/e2e/timeline-right-edge.test.mts b/packages/example/e2e/timeline-right-edge.test.mtsindex 3c7d061c9a..a5720c62c7 100644--- a/packages/example/e2e/timeline-right-edge.test.mts+++ b/packages/example/e2e/timeline-right-edge.test.mts@@ -1,5 +1,5 @@-import {expect, test} from '@playwright/test';import fs from 'fs';+import {expect, test} from '@playwright/test';import {rootFile, STUDIO_URL} from './constants.mts';import {startStudio, stopStudio} from './studio-server.mts';@@ -135,14 +135,20 @@ export const E2eTestRoot = () => <Composition id="timeline-edges" component={Layconst movableLayer = page.locator('[data-timeline-marquee-item][title="Natural end"]',);+ const movableLayerLabel = page.locator(+ '[data-remotion-sequence-reorder-row] [title="Natural end"]',+ );+ await movableLayerLabel.dblclick();+ await expect.poll(() => openInEditorRequests.length).toBe(1);+await movableLayer.click({button: 'right', position: {x: 30, y: 10}});const contextMenu = page.locator('[data-remotion-menu-tree-id]').last();await expect(contextMenu).toBeVisible();await movableLayer.click({position: {x: 30, y: 10}});await expect(contextMenu).not.toBeVisible();- expect(openInEditorRequests).toHaveLength(0);+ expect(openInEditorRequests).toHaveLength(1);await movableLayer.dblclick({position: {x: 30, y: 10}});- await expect.poll(() => openInEditorRequests.length).toBe(1);+ await expect.poll(() => openInEditorRequests.length).toBe(2);const rightEdgeLayer = page.locator('[data-timeline-marquee-item][title="Explicit fill cutoff"]',@@ -368,6 +374,38 @@ export const E2eTestRoot = () => <Composition id="timeline-edges" component={Lay];}).toEqual([6, 12, 174, 168]);++ const durationLayerLabel = page.locator(+ '[data-remotion-sequence-reorder-row] [title="Duration cutoff"]',+ );+ await movableLayerLabel.scrollIntoViewIfNeeded();+ await durationLayerLabel.scrollIntoViewIfNeeded();+ const movableLayerLabelBox = await movableLayerLabel.boundingBox();+ const durationLayerLabelBox = await durationLayerLabel.boundingBox();+ if (movableLayerLabelBox === null || durationLayerLabelBox === null) {+ throw new Error('Expected reorderable timeline labels to be visible');+ }++ await page.mouse.move(+ movableLayerLabelBox.x + movableLayerLabelBox.width / 2,+ movableLayerLabelBox.y + movableLayerLabelBox.height / 2,+ );+ await page.mouse.down();+ await page.mouse.move(+ durationLayerLabelBox.x + durationLayerLabelBox.width / 2,+ durationLayerLabelBox.y + durationLayerLabelBox.height * 0.75,+ {steps: 5},+ );+ await page.mouse.up();+ await expect+ .poll(() => {+ const source = fs.readFileSync(rootFile, 'utf-8');+ return (+ source.indexOf('name="Natural end"') >+ source.indexOf('name="Duration cutoff"')+ );+ })+ .toBe(true);} finally {await stopStudio();}diff --git a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsxindex 38526c9865..eaf63c2b0c 100644--- a/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequenceItem.tsx@@ -32,7 +32,7 @@ import {isStudioSelectionEnabled,} from '../../helpers/interactivity-enabled';import {useIsStill} from '../../helpers/is-current-selected-still';-import {startCapturedPointerSession} from '../../helpers/pointer-session';+import {startDeferredCapturedPointerSession} from '../../helpers/pointer-session';import {getStudioKeyboardShortcutsEnabled} from '../../helpers/studio-runtime-config';import {getTimelineLayerHeight,@@ -711,10 +711,10 @@ const TimelineSequenceItemInner: React.FC<{},});- stopSequencePointerSession.current = startCapturedPointerSession({+ stopSequencePointerSession.current = startDeferredCapturedPointerSession({captureTarget: sourceElement,event: e.nativeEvent,- onMove: (pointerEvent) => {+ onMove: (pointerEvent, capturePointer) => {currentClientY = pointerEvent.clientY;if (!didDrag &&@@ -728,6 +728,7 @@ const TimelineSequenceItemInner: React.FC<{if (!didDrag) {didDrag = true;+ capturePointer();previousUserSelect = document.body.style.userSelect;previousWebkitUserSelect = document.body.style.webkitUserSelect;document.body.style.userSelect = 'none';