@pixldocs/canvas-renderer 0.5.366 → 0.5.368

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.
@@ -11535,6 +11535,7 @@ const PageCanvas = forwardRef(
11535
11535
  const skipSelectionClearOnDiscardRef = useRef(false);
11536
11536
  const skipActiveSelectionBakeOnClearRef = useRef(false);
11537
11537
  const suppressObjectModifiedDuringInternalReselectRef = useRef(false);
11538
+ const suppressSelectionEventsUntilRef = useRef(0);
11538
11539
  const preserveEditingScopeOnSelectionClearRef = useRef(false);
11539
11540
  const preserveActiveSelectionAfterTransformRef = useRef(null);
11540
11541
  const recentGroupSelectionRestoreRef = useRef(null);
@@ -11583,9 +11584,17 @@ const PageCanvas = forwardRef(
11583
11584
  if (!fc || !groupId || snapshot.memberIds.length < 2 || editingTextIdRef.current) return;
11584
11585
  const members = snapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
11585
11586
  if (members.length < 2) return;
11587
+ const activeBeforeRestore = fc.getActiveObject();
11588
+ if (activeBeforeRestore instanceof fabric.ActiveSelection) {
11589
+ const activeMembers = activeBeforeRestore.getObjects();
11590
+ const sameMembers = activeMembers.length === members.length && members.every((member) => activeMembers.includes(member));
11591
+ const sameGroup = activeBeforeRestore.__pixldocsGroupSelection === groupId;
11592
+ const alreadyAligned = activeBeforeRestore.__pixldocsAlignedAngle != null;
11593
+ if (sameMembers && sameGroup && alreadyAligned) return;
11594
+ }
11586
11595
  isSyncingSelectionToFabricRef.current = true;
11587
11596
  try {
11588
- const active = fc.getActiveObject();
11597
+ const active = activeBeforeRestore;
11589
11598
  const selection = active instanceof fabric.ActiveSelection && members.every((member) => active.getObjects().includes(member)) ? active : new fabric.ActiveSelection(members, { canvas: fc });
11590
11599
  applyLogicalGroupSelectionVisualState(selection, groupId);
11591
11600
  fc.setActiveObject(selection);
@@ -12822,6 +12831,7 @@ const PageCanvas = forwardRef(
12822
12831
  };
12823
12832
  fabricCanvas.on("selection:created", () => {
12824
12833
  var _a2;
12834
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12825
12835
  syncSelectionToStore();
12826
12836
  const activeObj = fabricCanvas.getActiveObject();
12827
12837
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
@@ -12834,6 +12844,7 @@ const PageCanvas = forwardRef(
12834
12844
  });
12835
12845
  fabricCanvas.on("selection:updated", () => {
12836
12846
  var _a2;
12847
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12837
12848
  const next = fabricCanvas.getActiveObject();
12838
12849
  const isLogicalGroupSel = next instanceof fabric.ActiveSelection && (next.__pixldocsGroupSelection || Array.isArray(next.__pixldocsLogicalGroupIds));
12839
12850
  if (!isLogicalGroupSel) restoreSuppressedGroupBorders();
@@ -13195,6 +13206,14 @@ const PageCanvas = forwardRef(
13195
13206
  requestAnimationFrame(() => {
13196
13207
  setTimeout(() => {
13197
13208
  if (!isActiveRef.current) return;
13209
+ const active = fabricCanvas.getActiveObject();
13210
+ if (active instanceof fabric.ActiveSelection) {
13211
+ const activeIds = active.getObjects().map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
13212
+ const sameMembers = activeIds.length === snapshot.memberIds.length && snapshot.memberIds.every((id) => activeIds.includes(id));
13213
+ const sameGroup = active.__pixldocsGroupSelection === snapshot.groupSelectionId;
13214
+ const alreadyAligned = active.__pixldocsAlignedAngle != null;
13215
+ if (sameMembers && sameGroup && alreadyAligned) return;
13216
+ }
13198
13217
  restoreGroupSelectionSnapshot(snapshot);
13199
13218
  }, 0);
13200
13219
  });
@@ -15499,6 +15518,7 @@ const PageCanvas = forwardRef(
15499
15518
  const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
15500
15519
  fabricCanvas.renderOnAddRemove = false;
15501
15520
  suppressObjectModifiedDuringInternalReselectRef.current = true;
15521
+ suppressSelectionEventsUntilRef.current = performance.now() + 80;
15502
15522
  skipSelectionClearOnDiscardRef.current = true;
15503
15523
  skipActiveSelectionBakeOnClearRef.current = true;
15504
15524
  try {
@@ -15557,7 +15577,8 @@ const PageCanvas = forwardRef(
15557
15577
  groupSelectionId: wasGroupSel,
15558
15578
  expiresAt: Date.now() + 1200
15559
15579
  };
15560
- recentGroupSelectionRestoreRef.current = resizeRestoreSnapshot;
15580
+ preserveActiveSelectionAfterTransformRef.current = null;
15581
+ recentGroupSelectionRestoreRef.current = null;
15561
15582
  }
15562
15583
  fabricCanvas.requestRenderAll();
15563
15584
  }
@@ -15569,6 +15590,7 @@ const PageCanvas = forwardRef(
15569
15590
  unlockEditsSoon();
15570
15591
  } catch (e2) {
15571
15592
  suppressObjectModifiedDuringInternalReselectRef.current = false;
15593
+ suppressSelectionEventsUntilRef.current = 0;
15572
15594
  skipSelectionClearOnDiscardRef.current = false;
15573
15595
  skipActiveSelectionBakeOnClearRef.current = false;
15574
15596
  unlockEditsSoon();
@@ -24606,9 +24628,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24606
24628
  }
24607
24629
  return svgString;
24608
24630
  }
24609
- const resolvedPackageVersion = "0.5.366";
24631
+ const resolvedPackageVersion = "0.5.368";
24610
24632
  const PACKAGE_VERSION = resolvedPackageVersion;
24611
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.366";
24633
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.368";
24612
24634
  const roundParityValue = (value) => {
24613
24635
  if (typeof value !== "number") return value;
24614
24636
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25422,7 +25444,7 @@ class PixldocsRenderer {
25422
25444
  await this.waitForCanvasScene(container, cloned, i);
25423
25445
  }
25424
25446
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25425
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CDFFtLFe.js");
25447
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CHQahrQa.js");
25426
25448
  const prepared = preparePagesForExport(
25427
25449
  cloned.pages,
25428
25450
  canvasWidth,
@@ -27742,7 +27764,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27742
27764
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27743
27765
  sanitizeSvgTreeForPdf(svgToDraw);
27744
27766
  try {
27745
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CDFFtLFe.js");
27767
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CHQahrQa.js");
27746
27768
  try {
27747
27769
  await logTextMeasurementDiagnostic(svgToDraw);
27748
27770
  } catch {
@@ -28142,4 +28164,4 @@ export {
28142
28164
  buildTeaserBlurFlatKeys as y,
28143
28165
  collectFontDescriptorsFromConfig as z
28144
28166
  };
28145
- //# sourceMappingURL=index-B-g_kXIT.js.map
28167
+ //# sourceMappingURL=index-2nQEAwj1.js.map