From 421b3191fd692ef01fbc4356132f9745ef087700 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 13 Jun 2021 13:31:55 +0200 Subject: selection in timeline working sorta --- components/selection.tsx | 2 +- pages/editor.tsx | 38 ++++++++++++++++++++++++++++++++++++-- styles/editor.css | 4 ++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/components/selection.tsx b/components/selection.tsx index 4a0812f..d1753f0 100644 --- a/components/selection.tsx +++ b/components/selection.tsx @@ -68,7 +68,7 @@ export default function Selection(props: { left?: slideTypes; right?: slideTypes; }) { - var small = props.width < 24 || props.height < 24; + var small = props.width < 24 || props.height < 24 || !props.left || !props.right; return
{ + if (props.selectedTool != 'cursor') return; + // var frame = Math.max(0, Math.round(getFrameAtOffset(x - 240, timelineZoom)) - 1); + var timelineInner = document.querySelector('.timeline .timelineInner'); + var timelineRects = timelineInner.getBoundingClientRect(); + var tx = x - timelineRects.x + timelineInner.scrollLeft; + var ty = y - timelineRects.y; + var ix = bx - timelineRects.x + timelineInner.scrollLeft; + var iy = by - timelineRects.y; + + var sx = tx - ix; + var sy = ty - iy; + + setSelectionPosX(ix + Math.min(0, sx)); + setSelectionPosY(iy + Math.min(0, sy)); + setSelectionWidth(Math.abs(sx)); + setSelectionHeight(Math.abs(sy)); + }, { domTarget: selectionRef, eventOptions: { passive: false } }); + return <> )} - /> + > +
+ {workingTimeline.map((slide: anySlide) => )} +
} + /> +