Always use latest version of onConnectEnd & isValidConnection in Handle/ReconnectAnchors
This commit is contained in:
@@ -53,12 +53,10 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
|
||||
const {
|
||||
autoPanOnConnect,
|
||||
domNode,
|
||||
isValidConnection,
|
||||
connectionMode,
|
||||
connectionRadius,
|
||||
lib,
|
||||
onConnectStart,
|
||||
onConnectEnd,
|
||||
cancelConnection,
|
||||
nodeLookup,
|
||||
rfId: flowId,
|
||||
@@ -93,10 +91,10 @@ export function EdgeUpdateAnchors<EdgeType extends Edge = Edge>({
|
||||
flowId,
|
||||
cancelConnection,
|
||||
panBy,
|
||||
isValidConnection,
|
||||
isValidConnection: (...args) => store.getState().isValidConnection?.(...args) ?? true,
|
||||
onConnect: onConnectEdge,
|
||||
onConnectStart: _onConnectStart,
|
||||
onConnectEnd,
|
||||
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
||||
onReconnectEnd: _onReconnectEnd,
|
||||
updateConnection,
|
||||
getTransform: () => store.getState().transform,
|
||||
|
||||
@@ -142,10 +142,10 @@ function HandleComponent(
|
||||
panBy: currentStore.panBy,
|
||||
cancelConnection: currentStore.cancelConnection,
|
||||
onConnectStart: currentStore.onConnectStart,
|
||||
onConnectEnd: currentStore.onConnectEnd,
|
||||
onConnectEnd: (...args) => store.getState().onConnectEnd?.(...args),
|
||||
updateConnection: currentStore.updateConnection,
|
||||
onConnect: onConnectExtended,
|
||||
isValidConnection: isValidConnection || currentStore.isValidConnection,
|
||||
isValidConnection: isValidConnection || ((...args) => store.getState().isValidConnection?.(...args) ?? true),
|
||||
getTransform: () => store.getState().transform,
|
||||
getFromHandle: () => store.getState().connection.fromHandle,
|
||||
autoPanSpeed: currentStore.autoPanSpeed,
|
||||
|
||||
@@ -79,9 +79,9 @@
|
||||
flowId,
|
||||
cancelConnection,
|
||||
panBy,
|
||||
isValidConnection,
|
||||
isValidConnection: (...args) => store.isValidConnection?.(...args) ?? true,
|
||||
onConnectStart: _onConnectStart,
|
||||
onConnectEnd: onconnectend,
|
||||
onConnectEnd: (...args) => store.onconnectend?.(...args),
|
||||
onConnect: (connection) => {
|
||||
const reconnectedEdge = { ...edge, ...connection };
|
||||
const newEdge = onbeforereconnect
|
||||
|
||||
@@ -125,21 +125,14 @@
|
||||
autoPanOnConnect: store.autoPanOnConnect,
|
||||
autoPanSpeed: store.autoPanSpeed,
|
||||
flowId: store.flowId,
|
||||
isValidConnection: isValidConnection ?? store.isValidConnection,
|
||||
isValidConnection:
|
||||
isValidConnection || ((...args) => store.isValidConnection?.(...args) ?? true),
|
||||
updateConnection: store.updateConnection,
|
||||
cancelConnection: store.cancelConnection,
|
||||
panBy: store.panBy,
|
||||
onConnect: onConnectExtended,
|
||||
onConnectStart: (event, startParams) => {
|
||||
store.onconnectstart?.(event, {
|
||||
nodeId: startParams.nodeId,
|
||||
handleId: startParams.handleId,
|
||||
handleType: startParams.handleType
|
||||
});
|
||||
},
|
||||
onConnectEnd: (event, connectionState) => {
|
||||
store.onconnectend?.(event, connectionState);
|
||||
},
|
||||
onConnectStart: store.onconnectstart,
|
||||
onConnectEnd: (...args) => store.onconnectend?.(...args),
|
||||
getTransform: () => [store.viewport.x, store.viewport.y, store.viewport.zoom],
|
||||
getFromHandle: () => store.connection.fromHandle,
|
||||
dragThreshold: store.connectionDragThreshold,
|
||||
|
||||
Reference in New Issue
Block a user