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
@@ -34,12 +34,14 @@ interface EdgeRendererProps {
connectionPosition?: XYPosition
connectionMode: ConnectionMode
nodesConnectable?: boolean
edgesUpdatable?: boolean
}
const props = withDefaults(defineProps<EdgeRendererProps>(), {
arrowHeadColor: '#b1b1b7',
connectionLineType: ConnectionLineType.Bezier,
edgeUpdaterRadius: 10,
handleEdgeUpdate: false,
})
const getType = (type?: string) => {
@@ -85,6 +87,7 @@ export default {
:edge="edge"
:component="getType(edge.type)"
:selectable="props.elementsSelectable"
:updatable="typeof edge.updatable === 'undefined' ? props.edgesUpdatable : edge.updatable"
:edge-updater-radius="props.edgeUpdaterRadius"
:dimensions="props.dimensions"
:transform="props.transform"