@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.
@@ -11553,6 +11553,7 @@ const PageCanvas = react.forwardRef(
11553
11553
  const skipSelectionClearOnDiscardRef = react.useRef(false);
11554
11554
  const skipActiveSelectionBakeOnClearRef = react.useRef(false);
11555
11555
  const suppressObjectModifiedDuringInternalReselectRef = react.useRef(false);
11556
+ const suppressSelectionEventsUntilRef = react.useRef(0);
11556
11557
  const preserveEditingScopeOnSelectionClearRef = react.useRef(false);
11557
11558
  const preserveActiveSelectionAfterTransformRef = react.useRef(null);
11558
11559
  const recentGroupSelectionRestoreRef = react.useRef(null);
@@ -11601,9 +11602,17 @@ const PageCanvas = react.forwardRef(
11601
11602
  if (!fc || !groupId || snapshot.memberIds.length < 2 || editingTextIdRef.current) return;
11602
11603
  const members = snapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
11603
11604
  if (members.length < 2) return;
11605
+ const activeBeforeRestore = fc.getActiveObject();
11606
+ if (activeBeforeRestore instanceof fabric__namespace.ActiveSelection) {
11607
+ const activeMembers = activeBeforeRestore.getObjects();
11608
+ const sameMembers = activeMembers.length === members.length && members.every((member) => activeMembers.includes(member));
11609
+ const sameGroup = activeBeforeRestore.__pixldocsGroupSelection === groupId;
11610
+ const alreadyAligned = activeBeforeRestore.__pixldocsAlignedAngle != null;
11611
+ if (sameMembers && sameGroup && alreadyAligned) return;
11612
+ }
11604
11613
  isSyncingSelectionToFabricRef.current = true;
11605
11614
  try {
11606
- const active = fc.getActiveObject();
11615
+ const active = activeBeforeRestore;
11607
11616
  const selection = active instanceof fabric__namespace.ActiveSelection && members.every((member) => active.getObjects().includes(member)) ? active : new fabric__namespace.ActiveSelection(members, { canvas: fc });
11608
11617
  applyLogicalGroupSelectionVisualState(selection, groupId);
11609
11618
  fc.setActiveObject(selection);
@@ -12840,6 +12849,7 @@ const PageCanvas = react.forwardRef(
12840
12849
  };
12841
12850
  fabricCanvas.on("selection:created", () => {
12842
12851
  var _a2;
12852
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12843
12853
  syncSelectionToStore();
12844
12854
  const activeObj = fabricCanvas.getActiveObject();
12845
12855
  if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
@@ -12852,6 +12862,7 @@ const PageCanvas = react.forwardRef(
12852
12862
  });
12853
12863
  fabricCanvas.on("selection:updated", () => {
12854
12864
  var _a2;
12865
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12855
12866
  const next = fabricCanvas.getActiveObject();
12856
12867
  const isLogicalGroupSel = next instanceof fabric__namespace.ActiveSelection && (next.__pixldocsGroupSelection || Array.isArray(next.__pixldocsLogicalGroupIds));
12857
12868
  if (!isLogicalGroupSel) restoreSuppressedGroupBorders();
@@ -13213,6 +13224,14 @@ const PageCanvas = react.forwardRef(
13213
13224
  requestAnimationFrame(() => {
13214
13225
  setTimeout(() => {
13215
13226
  if (!isActiveRef.current) return;
13227
+ const active = fabricCanvas.getActiveObject();
13228
+ if (active instanceof fabric__namespace.ActiveSelection) {
13229
+ const activeIds = active.getObjects().map((obj) => getObjectId(obj)).filter((id) => !!id && id !== "__background__");
13230
+ const sameMembers = activeIds.length === snapshot.memberIds.length && snapshot.memberIds.every((id) => activeIds.includes(id));
13231
+ const sameGroup = active.__pixldocsGroupSelection === snapshot.groupSelectionId;
13232
+ const alreadyAligned = active.__pixldocsAlignedAngle != null;
13233
+ if (sameMembers && sameGroup && alreadyAligned) return;
13234
+ }
13216
13235
  restoreGroupSelectionSnapshot(snapshot);
13217
13236
  }, 0);
13218
13237
  });
@@ -15517,6 +15536,7 @@ const PageCanvas = react.forwardRef(
15517
15536
  const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
15518
15537
  fabricCanvas.renderOnAddRemove = false;
15519
15538
  suppressObjectModifiedDuringInternalReselectRef.current = true;
15539
+ suppressSelectionEventsUntilRef.current = performance.now() + 80;
15520
15540
  skipSelectionClearOnDiscardRef.current = true;
15521
15541
  skipActiveSelectionBakeOnClearRef.current = true;
15522
15542
  try {
@@ -15575,7 +15595,8 @@ const PageCanvas = react.forwardRef(
15575
15595
  groupSelectionId: wasGroupSel,
15576
15596
  expiresAt: Date.now() + 1200
15577
15597
  };
15578
- recentGroupSelectionRestoreRef.current = resizeRestoreSnapshot;
15598
+ preserveActiveSelectionAfterTransformRef.current = null;
15599
+ recentGroupSelectionRestoreRef.current = null;
15579
15600
  }
15580
15601
  fabricCanvas.requestRenderAll();
15581
15602
  }
@@ -15587,6 +15608,7 @@ const PageCanvas = react.forwardRef(
15587
15608
  unlockEditsSoon();
15588
15609
  } catch (e2) {
15589
15610
  suppressObjectModifiedDuringInternalReselectRef.current = false;
15611
+ suppressSelectionEventsUntilRef.current = 0;
15590
15612
  skipSelectionClearOnDiscardRef.current = false;
15591
15613
  skipActiveSelectionBakeOnClearRef.current = false;
15592
15614
  unlockEditsSoon();
@@ -24624,9 +24646,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24624
24646
  }
24625
24647
  return svgString;
24626
24648
  }
24627
- const resolvedPackageVersion = "0.5.366";
24649
+ const resolvedPackageVersion = "0.5.368";
24628
24650
  const PACKAGE_VERSION = resolvedPackageVersion;
24629
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.366";
24651
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.368";
24630
24652
  const roundParityValue = (value) => {
24631
24653
  if (typeof value !== "number") return value;
24632
24654
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25440,7 +25462,7 @@ class PixldocsRenderer {
25440
25462
  await this.waitForCanvasScene(container, cloned, i);
25441
25463
  }
25442
25464
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25443
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CKZP3dKs.cjs"));
25465
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C0aX5xXm.cjs"));
25444
25466
  const prepared = preparePagesForExport(
25445
25467
  cloned.pages,
25446
25468
  canvasWidth,
@@ -27760,7 +27782,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27760
27782
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27761
27783
  sanitizeSvgTreeForPdf(svgToDraw);
27762
27784
  try {
27763
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CKZP3dKs.cjs"));
27785
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C0aX5xXm.cjs"));
27764
27786
  try {
27765
27787
  await logTextMeasurementDiagnostic(svgToDraw);
27766
27788
  } catch {
@@ -28157,4 +28179,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28157
28179
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28158
28180
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28159
28181
  exports.warmTemplateFromForm = warmTemplateFromForm;
28160
- //# sourceMappingURL=index-HiqL7bUV.cjs.map
28182
+ //# sourceMappingURL=index-BuJEJzD7.cjs.map