aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-06-13 18:51:36 +0200
committerlonkaars <loek@pipeframe.xyz>2021-06-13 18:51:36 +0200
commitc5bf7ef263c58458103bc88a4964b84ffe450dc1 (patch)
tree9f7186bb8dfcf57c3d780c9309c4ccfc31f1bc6b
parent760bdb805fb6fdf809591c6743cb87038cf46fe0 (diff)
small tweak for first time selection
-rw-r--r--pages/editor.tsx4
1 files 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 <>