From b034f288d39e6fc58472db8711e5ba7b18ebc66b Mon Sep 17 00:00:00 2001 From: lonkaars Date: Wed, 16 Jun 2021 15:35:43 +0200 Subject: better selection background + grabbing css --- components/selection.tsx | 43 ++++++++++++++++++++++++++++++++----------- styles/editor.css | 7 ++++++- styles/selection.css | 33 ++++++++++++++++++++++++++------- 3 files changed, 64 insertions(+), 19 deletions(-) diff --git a/components/selection.tsx b/components/selection.tsx index bcc1656..52096df 100644 --- a/components/selection.tsx +++ b/components/selection.tsx @@ -35,7 +35,8 @@ function Corner(props: { fill='none' xmlns='http://www.w3.org/2000/svg' > - + + ; } @@ -49,15 +50,33 @@ function Corner(props: { xmlns='http://www.w3.org/2000/svg' > {{ - 'round': , - 'diamond': , - 'square': , + 'round': <> + + + , + 'diamond': <> + + + , + 'square': <> + + + , }[props.type]} ; } @@ -80,7 +99,9 @@ export default function Selection(props: { '--corner-size': small ? '6px' : '12px', } as CSSProperties} > -
+
+
+
diff --git a/styles/editor.css b/styles/editor.css index 8461a5a..1279c72 100644 --- a/styles/editor.css +++ b/styles/editor.css @@ -175,7 +175,12 @@ width: calc(var(--zoom) * var(--total-frames) * 1px); background-color: rgba(0, 0, 255, var(--debug-hitbox-opacity)); } -#selection { pointer-events: none; } +#selection { + cursor: grab; +} +#selection:active { + cursor: grabbing; +} .appGrid .timeline .ghostArea { pointer-events: none; diff --git a/styles/selection.css b/styles/selection.css index 3c0e78b..6e16cee 100644 --- a/styles/selection.css +++ b/styles/selection.css @@ -6,12 +6,22 @@ transition-property: transform, opacity; } +.selection .bar.top, +.selection .bar.bottom, +.selection .background.center { + left: var(--corner-size); + right: var(--corner-size); +} + .selection .bar.top, .selection .bar.bottom { height: 2px; +} - left: var(--corner-size); - right: var(--corner-size); +.selection .background.left, +.selection .background.right { + top: calc(var(--corner-size) - 2px); + bottom: calc(var(--corner-size) - 2px); } .selection .bar.left, @@ -22,6 +32,7 @@ bottom: var(--corner-size); } +.selection div.fill, .selection .bar { background-color: var(--selection-color); } @@ -30,12 +41,20 @@ fill: var(--selection-color); } -.selection.active .background { opacity: .12; } -.selection .background { - border-radius: 6px; - background-color: var(--selection-color); +.selection .fill { opacity: 0; - transition: opacity 200ms; + transition-property: opacity; + transition-duration: 200ms; +} + +.selection .background.left, +.selection .background.right { + width: var(--corner-size); +} + +.selection:hover .fill, +.selection.active .fill { + opacity: .15; } .selection.hidden { -- cgit v1.2.3