From c5bf7ef263c58458103bc88a4964b84ffe450dc1 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 13 Jun 2021 18:51:36 +0200 Subject: small tweak for first time selection --- pages/editor.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/editor.tsx b/pages/editor.tsx index e08d6ae..dc74699 100644 --- a/pages/editor.tsx +++ b/pages/editor.tsx @@ -345,7 +345,7 @@ function TimelineEditor(props: { config: { mass: 0.5, tension: 500, friction: 20 }, })); var selectionRef = useRef(null); - useDrag(({ xy: [x, y], initial: [bx, by], last, movement: [ox, oy] }) => { + useDrag(({ xy: [x, y], initial: [bx, by], first, last, movement: [ox, oy] }) => { if (props.selectedTool != 'cursor') return; // var frame = Math.max(0, Math.round(getFrameAtOffset(x - 240, timelineZoom)) - 1); var minDistance = 5; // minimal drag distance in pixels to register selection @@ -373,7 +373,7 @@ function TimelineEditor(props: { if (distanceTraveled <= minDistance) setSelectionHidden(true); } - selectionPosAPI.start({ x1, y1, x2, y2 }); + selectionPosAPI[first && selectionHidden ? 'set' : 'start']({ x1, y1, x2, y2 }); }, { domTarget: selectionRef, eventOptions: { passive: false } }); return <> -- cgit v1.2.3