@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.
@@ -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,7 +12849,7 @@ const PageCanvas = react.forwardRef(
12840
12849
  };
12841
12850
  fabricCanvas.on("selection:created", () => {
12842
12851
  var _a2;
12843
- if (suppressObjectModifiedDuringInternalReselectRef.current) return;
12852
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12844
12853
  syncSelectionToStore();
12845
12854
  const activeObj = fabricCanvas.getActiveObject();
12846
12855
  if (activeObj instanceof fabric__namespace.ActiveSelection) applyWarpAwareSelectionBorders(activeObj);
@@ -12853,7 +12862,7 @@ const PageCanvas = react.forwardRef(
12853
12862
  });
12854
12863
  fabricCanvas.on("selection:updated", () => {
12855
12864
  var _a2;
12856
- if (suppressObjectModifiedDuringInternalReselectRef.current) return;
12865
+ if (suppressObjectModifiedDuringInternalReselectRef.current || performance.now() < suppressSelectionEventsUntilRef.current) return;
12857
12866
  const next = fabricCanvas.getActiveObject();
12858
12867
  const isLogicalGroupSel = next instanceof fabric__namespace.ActiveSelection && (next.__pixldocsGroupSelection || Array.isArray(next.__pixldocsLogicalGroupIds));
12859
12868
  if (!isLogicalGroupSel) restoreSuppressedGroupBorders();
@@ -13215,6 +13224,14 @@ const PageCanvas = react.forwardRef(
13215
13224
  requestAnimationFrame(() => {
13216
13225
  setTimeout(() => {
13217
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
+ }
13218
13235
  restoreGroupSelectionSnapshot(snapshot);
13219
13236
  }, 0);
13220
13237
  });
@@ -15519,6 +15536,7 @@ const PageCanvas = react.forwardRef(
15519
15536
  const prevRenderOnAddRemove = fabricCanvas.renderOnAddRemove;
15520
15537
  fabricCanvas.renderOnAddRemove = false;
15521
15538
  suppressObjectModifiedDuringInternalReselectRef.current = true;
15539
+ suppressSelectionEventsUntilRef.current = performance.now() + 80;
15522
15540
  skipSelectionClearOnDiscardRef.current = true;
15523
15541
  skipActiveSelectionBakeOnClearRef.current = true;
15524
15542
  try {
@@ -15590,6 +15608,7 @@ const PageCanvas = react.forwardRef(
15590
15608
  unlockEditsSoon();
15591
15609
  } catch (e2) {
15592
15610
  suppressObjectModifiedDuringInternalReselectRef.current = false;
15611
+ suppressSelectionEventsUntilRef.current = 0;
15593
15612
  skipSelectionClearOnDiscardRef.current = false;
15594
15613
  skipActiveSelectionBakeOnClearRef.current = false;
15595
15614
  unlockEditsSoon();
@@ -24627,9 +24646,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24627
24646
  }
24628
24647
  return svgString;
24629
24648
  }
24630
- const resolvedPackageVersion = "0.5.367";
24649
+ const resolvedPackageVersion = "0.5.368";
24631
24650
  const PACKAGE_VERSION = resolvedPackageVersion;
24632
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.367";
24651
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.368";
24633
24652
  const roundParityValue = (value) => {
24634
24653
  if (typeof value !== "number") return value;
24635
24654
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25443,7 +25462,7 @@ class PixldocsRenderer {
25443
25462
  await this.waitForCanvasScene(container, cloned, i);
25444
25463
  }
25445
25464
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25446
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-IZ_tpeyw.cjs"));
25465
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C0aX5xXm.cjs"));
25447
25466
  const prepared = preparePagesForExport(
25448
25467
  cloned.pages,
25449
25468
  canvasWidth,
@@ -27763,7 +27782,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27763
27782
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27764
27783
  sanitizeSvgTreeForPdf(svgToDraw);
27765
27784
  try {
27766
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-IZ_tpeyw.cjs"));
27785
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C0aX5xXm.cjs"));
27767
27786
  try {
27768
27787
  await logTextMeasurementDiagnostic(svgToDraw);
27769
27788
  } catch {
@@ -28160,4 +28179,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28160
28179
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28161
28180
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28162
28181
  exports.warmTemplateFromForm = warmTemplateFromForm;
28163
- //# sourceMappingURL=index-CG1dGppw.cjs.map
28182
+ //# sourceMappingURL=index-BuJEJzD7.cjs.map