feat(edges): allow markers to have unique id

* fix overwriting by spreading marker def

Signed-off-by: bcakmakoglu <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
bcakmakoglu
2022-03-08 17:11:54 +01:00
parent c31deb897d
commit 994b403089
2 changed files with 2 additions and 1 deletions
@@ -22,7 +22,7 @@ const markers = computed(() => {
if (marker) {
const markerId = getMarkerId(marker)
if (!ids.includes(markerId)) {
if (typeof marker === 'object') markers.push({ id: markerId, color: marker.color || props.defaultColor, ...marker })
if (typeof marker === 'object') markers.push({ ...marker, id: markerId, color: marker.color || props.defaultColor })
else markers.push({ id: markerId, color: props.defaultColor, type: marker as MarkerType })
ids.push(markerId)
}
+1
View File
@@ -8,6 +8,7 @@ export enum MarkerType {
}
export interface EdgeMarker {
id?: string
type: MarkerType
color?: string
width?: number