From 956c0717df69731a9fd53a2acd08ceea8c6b7c9e Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Fri, 9 Jul 2021 20:52:08 +0100 Subject: [PATCH] Further simplifies shape tree --- state/shape-utils/dot.tsx | 6 +----- state/shape-utils/ellipse.tsx | 10 ++++------ state/shape-utils/group.tsx | 3 +-- state/shape-utils/ray.tsx | 8 ++++---- state/shape-utils/text.tsx | 11 +++-------- 5 files changed, 13 insertions(+), 25 deletions(-) diff --git a/state/shape-utils/dot.tsx b/state/shape-utils/dot.tsx index 6419f6544..302f9d960 100644 --- a/state/shape-utils/dot.tsx +++ b/state/shape-utils/dot.tsx @@ -20,13 +20,9 @@ const dot = registerShapeUtils({ }, render(shape) { - const { id } = shape - const styles = getShapeStyle(shape.style) - return ( - - ) + return }, getBounds(shape) { diff --git a/state/shape-utils/ellipse.tsx b/state/shape-utils/ellipse.tsx index 8e7412ad5..062bef8c0 100644 --- a/state/shape-utils/ellipse.tsx +++ b/state/shape-utils/ellipse.tsx @@ -42,8 +42,8 @@ const ellipse = registerShapeUtils({ ) }, - render(shape, { isHovered }) { - const { id, radiusX, radiusY, style } = shape + render(shape) { + const { radiusX, radiusY, style } = shape const styles = getShapeStyle(style) const strokeWidth = +styles.strokeWidth @@ -58,7 +58,7 @@ const ellipse = registerShapeUtils({ const path = pathCache.get(shape) return ( - + <> {style.isFilled && ( ({ stroke={styles.stroke} strokeWidth={strokeWidth} pointerEvents="all" - filter={isHovered ? 'url(#expand)' : 'none'} /> - + ) } @@ -108,7 +107,6 @@ const ellipse = registerShapeUtils({ strokeDasharray={strokeDasharray} strokeDashoffset={strokeDashoffset} pointerEvents={style.isFilled ? 'all' : 'stroke'} - filter={isHovered ? 'url(#expand)' : 'none'} /> ) }, diff --git a/state/shape-utils/group.tsx b/state/shape-utils/group.tsx index 025b6ccd1..e6f43ed5c 100644 --- a/state/shape-utils/group.tsx +++ b/state/shape-utils/group.tsx @@ -26,11 +26,10 @@ const group = registerShapeUtils({ }, render(shape) { - const { id, size } = shape + const { size } = shape return ( ({ shouldRender(shape, prev) { return shape.direction !== prev.direction || shape.style !== prev.style }, - render(shape, { isHovered }) { - const { id, direction } = shape + render(shape) { + const { direction } = shape const styles = getShapeStyle(shape.style) const [x2, y2] = vec.add([0, 0], vec.mul(direction, 10000)) return ( - + <> - + ) }, diff --git a/state/shape-utils/text.tsx b/state/shape-utils/text.tsx index 9bcec55e5..145ceb5e6 100644 --- a/state/shape-utils/text.tsx +++ b/state/shape-utils/text.tsx @@ -70,7 +70,7 @@ const text = registerShapeUtils({ ) }, - render(shape, { isEditing, isHovered, ref }) { + render(shape, { isEditing, ref }) { const { id, text, style } = shape const styles = getShapeStyle(style) const font = getFontStyle(shape.scale, shape.style) @@ -131,11 +131,7 @@ const text = registerShapeUtils({ if (!isEditing) { return ( - + <> {text.split('\n').map((str, i) => ( ({ {str} ))} - + ) } @@ -167,7 +163,6 @@ const text = registerShapeUtils({ return (