|
|
@@ -25,34 +25,38 @@ export default function Selected() {
|
|
25
|
25
|
)
|
|
26
|
26
|
}
|
|
27
|
27
|
|
|
28
|
|
-export const ShapeOutline = memo(
|
|
29
|
|
- ({ id, isSelected }: { id: string; isSelected: boolean }) => {
|
|
30
|
|
- const rIndicator = useRef<SVGUseElement>(null)
|
|
|
28
|
+export const ShapeOutline = memo(function ShapeOutline({
|
|
|
29
|
+ id,
|
|
|
30
|
+ isSelected,
|
|
|
31
|
+}: {
|
|
|
32
|
+ id: string
|
|
|
33
|
+ isSelected: boolean
|
|
|
34
|
+}) {
|
|
|
35
|
+ const rIndicator = useRef<SVGUseElement>(null)
|
|
31
|
36
|
|
|
32
|
|
- const shape = useSelector(({ data }) => getPage(data).shapes[id])
|
|
|
37
|
+ const shape = useSelector(({ data }) => getPage(data).shapes[id])
|
|
33
|
38
|
|
|
34
|
|
- const events = useShapeEvents(id, rIndicator)
|
|
|
39
|
+ const events = useShapeEvents(id, rIndicator)
|
|
35
|
40
|
|
|
36
|
|
- if (!shape) return null
|
|
|
41
|
+ if (!shape) return null
|
|
37
|
42
|
|
|
38
|
|
- const transform = `
|
|
|
43
|
+ const transform = `
|
|
39
|
44
|
rotate(${shape.rotation * (180 / Math.PI)},
|
|
40
|
45
|
${getShapeUtils(shape).getCenter(shape)})
|
|
41
|
46
|
translate(${shape.point})
|
|
42
|
47
|
`
|
|
43
|
48
|
|
|
44
|
|
- return (
|
|
45
|
|
- <SelectIndicator
|
|
46
|
|
- ref={rIndicator}
|
|
47
|
|
- as="use"
|
|
48
|
|
- href={'#' + id}
|
|
49
|
|
- transform={transform}
|
|
50
|
|
- isLocked={shape.isLocked}
|
|
51
|
|
- {...events}
|
|
52
|
|
- />
|
|
53
|
|
- )
|
|
54
|
|
- }
|
|
55
|
|
-)
|
|
|
49
|
+ return (
|
|
|
50
|
+ <SelectIndicator
|
|
|
51
|
+ ref={rIndicator}
|
|
|
52
|
+ as="use"
|
|
|
53
|
+ href={'#' + id}
|
|
|
54
|
+ transform={transform}
|
|
|
55
|
+ isLocked={shape.isLocked}
|
|
|
56
|
+ {...events}
|
|
|
57
|
+ />
|
|
|
58
|
+ )
|
|
|
59
|
+})
|
|
56
|
60
|
|
|
57
|
61
|
const SelectIndicator = styled('path', {
|
|
58
|
62
|
zStrokeWidth: 3,
|