refactor(edges): Make edge updating optional

* add an option to enable edge updating globally
* pass an option to an edge to enable updating for a single edge

Signed-off-by: Braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2021-11-26 11:08:12 +01:00
parent 98b6fdb717
commit 4630f3efc1
12 changed files with 48 additions and 27 deletions
+13 -2
View File
@@ -10,6 +10,7 @@ interface EdgeWrapper {
markerEndId?: string
edgeUpdaterRadius?: number
selectable?: boolean
updatable?: boolean
dimensions: Dimensions
transform: Transform
}
@@ -192,7 +193,12 @@ export default {
}"
/>
</slot>
<g @mousedown="onEdgeUpdaterSourceMouseDown" @mouseenter="onEdgeUpdaterMouseEnter" @mouseout="onEdgeUpdaterMouseOut">
<g
v-if="props.updatable"
@mousedown="onEdgeUpdaterSourceMouseDown"
@mouseenter="onEdgeUpdaterMouseEnter"
@mouseout="onEdgeUpdaterMouseOut"
>
<EdgeAnchor
:position="sourcePosition"
:center-x="edgePos.sourceX"
@@ -200,7 +206,12 @@ export default {
:radius="props.edgeUpdaterRadius"
/>
</g>
<g @mousedown="onEdgeUpdaterTargetMouseDown" @mouseenter="onEdgeUpdaterMouseEnter" @mouseout="onEdgeUpdaterMouseOut">
<g
v-if="props.updatable"
@mousedown="onEdgeUpdaterTargetMouseDown"
@mouseenter="onEdgeUpdaterMouseEnter"
@mouseout="onEdgeUpdaterMouseOut"
>
<EdgeAnchor
:position="targetPosition"
:center-x="edgePos.targetX"