@@ -84,6 +84,14 @@ const point2: Ref<AbsolutePosition | undefined> = useEndpointResolution(
84
84
},
85
85
);
86
86
87
+ const animationEnabled = computed (() => {
88
+ return (
89
+ props .animated ||
90
+ props .animationDuration != null ||
91
+ props .animationDelay != null
92
+ );
93
+ });
94
+
87
95
const { arrowSvg, textPosition } = useRoughArrow ({
88
96
point1 ,
89
97
point2 ,
@@ -94,19 +102,18 @@ const { arrowSvg, textPosition } = useRoughArrow({
94
102
headSize: props .headSize ? Number (props .headSize ) : null ,
95
103
roughness: props .roughness ? Number (props .roughness ) : undefined ,
96
104
seed: props .seed ? Number (props .seed ) : undefined ,
97
- animation:
98
- props .animated || props .animationDuration || props .animationDelay
99
- ? {
100
- duration:
101
- props .animationDuration != null
102
- ? Number (props .animationDuration )
103
- : undefined ,
104
- delay:
105
- props .animationDelay != null
106
- ? Number (props .animationDelay )
107
- : undefined ,
108
- }
109
- : undefined ,
105
+ animation: animationEnabled .value
106
+ ? {
107
+ duration:
108
+ props .animationDuration != null
109
+ ? Number (props .animationDuration )
110
+ : undefined ,
111
+ delay:
112
+ props .animationDelay != null
113
+ ? Number (props .animationDelay )
114
+ : undefined ,
115
+ }
116
+ : undefined ,
110
117
strokeAnimationKeyframeName: " rough-arrow-dash" ,
111
118
fillAnimationKeyframeName: " rough-arrow-fill" ,
112
119
});
@@ -135,14 +142,10 @@ const { arrowSvg, textPosition } = useRoughArrow({
135
142
left: `${textPosition.x}px`,
136
143
top: `${textPosition.y}px`,
137
144
transform: 'translate(-50%, -50%)',
138
- visibility:
139
- props.animated || props.animationDuration || props.animationDelay
140
- ? 'hidden'
141
- : 'visible',
142
- animation:
143
- props.animated || props.animationDuration || props.animationDelay
144
- ? `rough-arrow-content ${props.animationDuration ?? DEFAULT_ANIMATION_DURATION}ms ease-out ${props.animationDelay ?? 0}ms forwards`
145
- : 'none',
145
+ visibility: animationEnabled ? 'hidden' : 'visible',
146
+ animation: animationEnabled
147
+ ? `rough-arrow-content ${props.animationDuration ?? DEFAULT_ANIMATION_DURATION}ms ease-out ${props.animationDelay ?? 0}ms forwards`
148
+ : 'none',
146
149
}"
147
150
>
148
151
<slot />
0 commit comments