-
-
Notifications
You must be signed in to change notification settings - Fork 209
/
Marker.vue
55 lines (52 loc) 路 1.12 KB
/
Marker.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<script lang="ts" setup>
import { MarkerType } from '../../types/edge'
import type { MarkerProps } from '../../types/edge'
const {
id,
type,
width = 12.5,
height = 12.5,
markerUnits = 'strokeWidth',
orient = 'auto-start-reverse',
strokeWidth = 1,
color = 'none',
} = defineProps<MarkerProps>()
</script>
<script lang="ts">
export default {
name: 'MarkerType',
compatConfig: { MODE: 3 },
}
</script>
<template>
<marker
:id="id"
class="vue-flow__arrowhead"
viewBox="-10 -10 20 20"
refX="0"
refY="0"
:markerWidth="`${width}`"
:markerHeight="`${height}`"
:markerUnits="markerUnits"
:orient="orient"
>
<polyline
v-if="type === MarkerType.ArrowClosed"
:stroke="color"
stroke-linecap="round"
stroke-linejoin="round"
:stroke-width="strokeWidth"
:fill="color"
points="-5,-4 0,0 -5,4 -5,-4"
/>
<polyline
v-if="type === MarkerType.Arrow"
:stroke="color"
stroke-linecap="round"
stroke-linejoin="round"
:stroke-width="strokeWidth"
fill="none"
points="-5,-4 0,0 -5,4"
/>
</marker>
</template>