refactor(core): add connection start and end handles to store state

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-04-03 08:53:33 +02:00
committed by Braks
parent eab9991762
commit 4efc787067
8 changed files with 53 additions and 32 deletions
+3 -2
View File
@@ -483,15 +483,16 @@ export function useActions(state: State, getters: ComputedGetters): Actions {
state.connectionStartHandle = startHandle
}
state.connectionEndHandle = null
state.connectionStatus = null
if (position) state.connectionPosition = position
}
const updateConnection: Actions['updateConnection'] = (position, result, status = null) => {
const updateConnection: Actions['updateConnection'] = (position, result = null, status = null) => {
if (state.connectionStartHandle) {
state.connectionPosition = position
state.connectionStartHandle.result = result
state.connectionEndHandle = result
state.connectionStatus = status
}
}
+1
View File
@@ -85,6 +85,7 @@ function defaultState(): State {
},
connectionMode: ConnectionMode.Loose,
connectionStartHandle: null,
connectionEndHandle: null,
connectionClickStartHandle: null,
connectionPosition: { x: NaN, y: NaN },
connectionRadius: 20,