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