From eee30e2556e555affbd0f3034b4b2089352cea7c Mon Sep 17 00:00:00 2001 From: lonkaars Date: Sun, 13 Jun 2021 12:15:07 +0200 Subject: added selection component --- components/selection.tsx | 89 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 components/selection.tsx (limited to 'components') diff --git a/components/selection.tsx b/components/selection.tsx new file mode 100644 index 0000000..4a0812f --- /dev/null +++ b/components/selection.tsx @@ -0,0 +1,89 @@ +import { CSSProperties } from 'react'; +import { slideTypes } from '../timeline'; + +type cornerTypes = 'round' | 'diamond' | 'square' | 'square-s'; +var slideTypeToCornerType = { + default: 'diamond', + loop: 'square', + speedChange: 'square', + delay: 'round', +}; + +function Corner(props: { + type: cornerTypes; + direction: 'tl' | 'tr' | 'bl' | 'br'; +}) { + var className = 'corner posabs ' + props.direction + ' '; + + if (props.direction[0] == 't') className += 't0 '; + if (props.direction[0] == 'b') className += 'b0 '; + if (props.direction[1] == 'l') className += 'l0 '; + if (props.direction[1] == 'r') className += 'r0 '; + + var style: CSSProperties = { transform: '' }; + if (props.direction[0] == 'b') style.transform += 'scaleY(-1) '; + if (props.direction[1] == 'l') style.transform += 'scaleX(-1) '; + + if (props.type == 'square-s') { + className += 'small '; + return + + ; + } + + return + {{ + 'round': , + 'diamond': , + 'square': , + }[props.type]} + ; +} + +export default function Selection(props: { + width: number; + height: number; + left?: slideTypes; + right?: slideTypes; +}) { + var small = props.width < 24 || props.height < 24; + return
+
+
+
+
+ + + + +
; +} -- cgit v1.2.3