@@ -4,8 +4,10 @@ import { useElementPosition, type SnapPosition } from "./use-element-position";
4
4
import { useRoughArrow } from " ./use-rough-arrow" ;
5
5
6
6
const props = defineProps <{
7
- id1? : string ;
8
- id2? : string ;
7
+ q1? : string ;
8
+ q2? : string ;
9
+ id1? : string ; // Deprecated
10
+ id2? : string ; // Deprecated
9
11
pos1? : SnapPosition ;
10
12
pos2? : SnapPosition ;
11
13
x1? : number | string ;
@@ -29,21 +31,22 @@ const slideContainer = computed(() => {
29
31
30
32
const svgContainer = ref <SVGSVGElement >();
31
33
32
- const point1 = props .id1
33
- ? useElementPosition (
34
- slideContainer ,
35
- svgContainer ,
36
- ` #${props .id1 } ` ,
37
- props .pos1 ,
38
- )
34
+ const query1 = computed (() => {
35
+ if (props .q1 ) return props .q1 ;
36
+ if (props .id1 ) return ` #${props .id1 } ` ;
37
+ return undefined ;
38
+ });
39
+ const query2 = computed (() => {
40
+ if (props .q2 ) return props .q2 ;
41
+ if (props .id2 ) return ` #${props .id2 } ` ;
42
+ return undefined ;
43
+ });
44
+
45
+ const point1 = query1 .value
46
+ ? useElementPosition (slideContainer , svgContainer , query1 .value , props .pos1 )
39
47
: ref ({ x: Number (props .x1 ?? 0 ), y: Number (props .y1 ?? 0 ) });
40
- const point2 = props .id2
41
- ? useElementPosition (
42
- slideContainer ,
43
- svgContainer ,
44
- ` #${props .id2 } ` ,
45
- props .pos2 ,
46
- )
48
+ const point2 = query2 .value
49
+ ? useElementPosition (slideContainer , svgContainer , query2 .value , props .pos2 )
47
50
: ref ({ x: Number (props .x2 ?? 0 ), y: Number (props .y2 ?? 0 ) });
48
51
49
52
const { arcSvg, textPosition } = useRoughArrow ({
0 commit comments