system-canvas-standalone 0.2.43 → 0.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15447,7 +15447,15 @@ var SystemCanvas = (() => {
15447
15447
  continue;
15448
15448
  if (y < n.y || y > n.y + n.height)
15449
15449
  continue;
15450
- if (cb([st.source], n))
15450
+ const movingNodes = [st.source];
15451
+ for (const [id2] of st.moving) {
15452
+ if (id2 !== st.source.id) {
15453
+ const mn = nodesRef.current?.find((r) => r.id === id2);
15454
+ if (mn)
15455
+ movingNodes.push(mn);
15456
+ }
15457
+ }
15458
+ if (cb(movingNodes, n))
15451
15459
  return n.id;
15452
15460
  return null;
15453
15461
  }
@@ -15499,7 +15507,15 @@ var SystemCanvas = (() => {
15499
15507
  const nodes = nodesRef.current;
15500
15508
  const target = nodes?.find((n) => n.id === dropTarget) ?? null;
15501
15509
  if (target && onNodeDropRef.current) {
15502
- onNodeDropRef.current([st.source], target);
15510
+ const movingNodes = [st.source];
15511
+ for (const [id2] of st.moving) {
15512
+ if (id2 !== st.source.id) {
15513
+ const mn = nodesRef.current?.find((r) => r.id === id2);
15514
+ if (mn)
15515
+ movingNodes.push(mn);
15516
+ }
15517
+ }
15518
+ onNodeDropRef.current(movingNodes, target);
15503
15519
  stateRef.current = null;
15504
15520
  movedRef.current = false;
15505
15521
  dropTargetIdRef.current = null;
@@ -16517,8 +16533,10 @@ var SystemCanvas = (() => {
16517
16533
  function useZoomNavigation(options) {
16518
16534
  const { enabled, config, nodes, currentCanvas, parentFrame, canvases, onResolveCanvas, onSeedCanvas, theme, getViewportSize, getCursorScreenPos, onEnter, onExit } = options;
16519
16535
  const committingRef = (0, import_react10.useRef)(false);
16536
+ const pendingNavRefRef = (0, import_react10.useRef)(null);
16520
16537
  (0, import_react10.useEffect)(() => {
16521
16538
  committingRef.current = false;
16539
+ pendingNavRefRef.current = null;
16522
16540
  }, [currentCanvas]);
16523
16541
  const exitArmedRef = (0, import_react10.useRef)(false);
16524
16542
  (0, import_react10.useEffect)(() => {
@@ -16613,7 +16631,7 @@ var SystemCanvas = (() => {
16613
16631
  }
16614
16632
  }
16615
16633
  }
16616
- if (bestCandidate) {
16634
+ if (bestCandidate && !(pendingNavRefRef.current !== null && bestCandidate.node.ref !== pendingNavRefRef.current)) {
16617
16635
  const n = bestCandidate.node;
16618
16636
  const screen = bestCandidate.screen;
16619
16637
  const ref = n.ref;
@@ -16684,8 +16702,12 @@ var SystemCanvas = (() => {
16684
16702
  ]);
16685
16703
  const clearCommitting = (0, import_react10.useCallback)(() => {
16686
16704
  committingRef.current = false;
16705
+ pendingNavRefRef.current = null;
16706
+ }, []);
16707
+ const setPendingNavRef = (0, import_react10.useCallback)((ref) => {
16708
+ pendingNavRefRef.current = ref;
16687
16709
  }, []);
16688
- return { handleViewportChange, clearCommitting };
16710
+ return { handleViewportChange, clearCommitting, setPendingNavRef };
16689
16711
  }
16690
16712
 
16691
16713
  // ../react/dist/components/Viewport.js
@@ -23378,6 +23400,7 @@ var SystemCanvas = (() => {
23378
23400
  }
23379
23401
  const handle = viewportHandleRef.current;
23380
23402
  if (handle) {
23403
+ setZoomNavPendingRef(node.ref ?? null);
23381
23404
  handle.zoomToNode(node, () => {
23382
23405
  const finalVp = viewportStateRef.current;
23383
23406
  if (finalVp)
@@ -23408,7 +23431,7 @@ var SystemCanvas = (() => {
23408
23431
  navigateToBreadcrumb(breadcrumbs.length - 2);
23409
23432
  }, [navigateToBreadcrumb, breadcrumbs.length]);
23410
23433
  const currentParentFrame = parentFrames[parentFrames.length - 1] ?? null;
23411
- const { handleViewportChange: handleZoomNavViewportChange, clearCommitting: clearZoomNavCommitting } = useZoomNavigation({
23434
+ const { handleViewportChange: handleZoomNavViewportChange, clearCommitting: clearZoomNavCommitting, setPendingNavRef: setZoomNavPendingRef } = useZoomNavigation({
23412
23435
  enabled: zoomNavConfig.enabled,
23413
23436
  config: zoomNavConfig,
23414
23437
  nodes,