@pixldocs/canvas-renderer 0.5.367 → 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,7 +12831,7 @@ const PageCanvas = forwardRef(
12822
12831
  };
12823
12832
  fabricCanvas.on("selection:created", () => {
12824
12833
  var _a2;
12825
- if (suppressObjectModifiedDuringInternalReselectRef.current) return;
12834
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12826
12835
  syncSelectionToStore();
12827
12836
  const activeObj = fabricCanvas.getActiveObject();
12828
12837
  if (activeObj instanceof fabric.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
@@ -12835,7 +12844,7 @@ const PageCanvas = forwardRef(
12835
12844
  });
12836
12845
  fabricCanvas.on("selection:updated", () => {
12837
12846
  var _a2;
12838
- if (suppressObjectModifiedDuringInternalReselectRef.current) return;
12847
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12839
12848
  const next = fabricCanvas.getActiveObject();
12840
12849
  const isLogicalGroupSel = next instanceof fabric.ActiveSelection && (next.__pixldocsGroupSelection || Array.isArray(next.__pixldocsLogicalGroupIds));
12841
12850
  if (!isLogicalGroupSel) restoreSuppressedGroupBorders();
@@ -13197,6 +13206,14 @@ const PageCanvas = forwardRef(
13197
13206
  requestAnimationFrame(() => {
13198
13207
  setTimeout(() => {
13199
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
+ }
13200
13217
  restoreGroupSelectionSnapshot(snapshot);
13201
13218
  }, 0);
13202
13219
  });
@@ -15501,6 +15518,7 @@ const PageCanvas = forwardRef(
15501
15518
  const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
15502
15519
  fabricCanvas.renderOnAddRemove = false;
15503
15520
  suppressObjectModifiedDuringInternalReselectRef.current = true;
15521
+ suppressSelectionEventsUntilRef.current = performance.now() + 80;
15504
15522
  skipSelectionClearOnDiscardRef.current = true;
15505
15523
  skipActiveSelectionBakeOnClearRef.current = true;
15506
15524
  try {
@@ -15572,6 +15590,7 @@ const PageCanvas = forwardRef(
15572
15590
  unlockEditsSoon();
15573
15591
  } catch (e2) {
15574
15592
  suppressObjectModifiedDuringInternalReselectRef.current = false;
15593
+ suppressSelectionEventsUntilRef.current = 0;
15575
15594
  skipSelectionClearOnDiscardRef.current = false;
15576
15595
  skipActiveSelectionBakeOnClearRef.current = false;
15577
15596
  unlockEditsSoon();
@@ -24609,9 +24628,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24609
24628
  }
24610
24629
  return svgString;
24611
24630
  }
24612
- const resolvedPackageVersion = "0.5.367";
24631
+ const resolvedPackageVersion = "0.5.368";
24613
24632
  const PACKAGE_VERSION = resolvedPackageVersion;
24614
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.367";
24633
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.368";
24615
24634
  const roundParityValue = (value) => {
24616
24635
  if (typeof value !== "number") return value;
24617
24636
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25425,7 +25444,7 @@ class PixldocsRenderer {
25425
25444
  await this.waitForCanvasScene(container, cloned, i);
25426
25445
  }
25427
25446
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25428
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DvcAOjPg.js");
25447
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CHQahrQa.js");
25429
25448
  const prepared = preparePagesForExport(
25430
25449
  cloned.pages,
25431
25450
  canvasWidth,
@@ -27745,7 +27764,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27745
27764
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27746
27765
  sanitizeSvgTreeForPdf(svgToDraw);
27747
27766
  try {
27748
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DvcAOjPg.js");
27767
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CHQahrQa.js");
27749
27768
  try {
27750
27769
  await logTextMeasurementDiagnostic(svgToDraw);
27751
27770
  } catch {
@@ -28145,4 +28164,4 @@ export {
28145
28164
  buildTeaserBlurFlatKeys as y,
28146
28165
  collectFontDescriptorsFromConfig as z
28147
28166
  };
28148
- //# sourceMappingURL=index-BeQl1M5I.js.map
28167
+ //# sourceMappingURL=index-2nQEAwj1.js.map