@pixldocs/canvas-renderer 0.5.285 → 0.5.286

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.
@@ -11248,6 +11248,26 @@ const PageCanvas = react.forwardRef(
11248
11248
  hoveredGroupId
11249
11249
  } = useEditorStore();
11250
11250
  const storeSelectedIds = canvas.selectedIds ?? [];
11251
+ const restoreGroupSelectionSnapshot = react.useCallback((snapshot) => {
11252
+ const fc = fabricRef.current;
11253
+ const groupId = snapshot == null ? void 0 : snapshot.groupSelectionId;
11254
+ if (!fc || !groupId || snapshot.memberIds.length < 2 || editingTextIdRef.current) return;
11255
+ const members = snapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
11256
+ if (members.length < 2) return;
11257
+ isSyncingSelectionToFabricRef.current = true;
11258
+ try {
11259
+ const active = fc.getActiveObject();
11260
+ const selection = active instanceof fabric__namespace.ActiveSelection && members.every((member) => active.getObjects().includes(member)) ? active : new fabric__namespace.ActiveSelection(members, { canvas: fc });
11261
+ applyLogicalGroupSelectionVisualState(selection, groupId);
11262
+ fc.setActiveObject(selection);
11263
+ selection.setCoords();
11264
+ fc.requestRenderAll();
11265
+ } finally {
11266
+ requestAnimationFrame(() => {
11267
+ isSyncingSelectionToFabricRef.current = false;
11268
+ });
11269
+ }
11270
+ }, [applyLogicalGroupSelectionVisualState]);
11251
11271
  const currentPage = react.useMemo(() => (canvas.pages ?? []).find((p) => p.id === pageId), [canvas.pages, pageId]);
11252
11272
  react.useMemo(() => {
11253
11273
  const ids = storeSelectedIds ?? [];
@@ -12702,32 +12722,11 @@ const PageCanvas = react.forwardRef(
12702
12722
  const restorePreservedGroupSelectionSoon = (snapshot = preserveActiveSelectionAfterTransformRef.current) => {
12703
12723
  if (!(snapshot == null ? void 0 : snapshot.groupSelectionId) || snapshot.memberIds.length < 2) return;
12704
12724
  const groupId = snapshot.groupSelectionId;
12705
- const memberIds = [...snapshot.memberIds];
12706
12725
  selectElements([groupId], false, false);
12707
12726
  requestAnimationFrame(() => {
12708
12727
  setTimeout(() => {
12709
- const fc = fabricRef.current;
12710
- if (!fc || !isActiveRef.current || editingTextIdRef.current) return;
12711
- const active = fc.getActiveObject();
12712
- if (active instanceof fabric__namespace.ActiveSelection && active.__pixldocsGroupSelection === groupId) {
12713
- restoreGroupSelectionVisualState(active, groupId);
12714
- fc.requestRenderAll();
12715
- return;
12716
- }
12717
- const members = memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
12718
- if (members.length < 2) return;
12719
- isSyncingSelectionToFabricRef.current = true;
12720
- try {
12721
- const selection = new fabric__namespace.ActiveSelection(members, { canvas: fc });
12722
- restoreGroupSelectionVisualState(selection, groupId);
12723
- fc.setActiveObject(selection);
12724
- selection.setCoords();
12725
- fc.requestRenderAll();
12726
- } finally {
12727
- requestAnimationFrame(() => {
12728
- isSyncingSelectionToFabricRef.current = false;
12729
- });
12730
- }
12728
+ if (!isActiveRef.current) return;
12729
+ restoreGroupSelectionSnapshot(snapshot);
12731
12730
  }, 0);
12732
12731
  });
12733
12732
  };
@@ -13197,7 +13196,8 @@ const PageCanvas = react.forwardRef(
13197
13196
  if (memberIds.length > 1) {
13198
13197
  restorePreservedGroupSelectionSoon({
13199
13198
  memberIds,
13200
- groupSelectionId: pendingDrillIn.groupId
13199
+ groupSelectionId: pendingDrillIn.groupId,
13200
+ expiresAt: Date.now() + 1200
13201
13201
  });
13202
13202
  } else {
13203
13203
  selectElements([pendingDrillIn.groupId], false, false);
@@ -15707,6 +15707,10 @@ const PageCanvas = react.forwardRef(
15707
15707
  }
15708
15708
  }
15709
15709
  }
15710
+ const recentGroupRestore = recentGroupSelectionRestoreRef.current;
15711
+ if ((recentGroupRestore == null ? void 0 : recentGroupRestore.groupSelectionId) && recentGroupRestore.expiresAt > Date.now()) {
15712
+ restoreGroupSelectionSnapshot(recentGroupRestore);
15713
+ }
15710
15714
  preserveSelectionAfterTransformIdRef.current = null;
15711
15715
  preserveActiveSelectionAfterTransformRef.current = null;
15712
15716
  syncTriggeredByPanelRef.current = false;
@@ -23630,9 +23634,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23630
23634
  }
23631
23635
  return svgString;
23632
23636
  }
23633
- const resolvedPackageVersion = "0.5.285";
23637
+ const resolvedPackageVersion = "0.5.286";
23634
23638
  const PACKAGE_VERSION = resolvedPackageVersion;
23635
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.285";
23639
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.286";
23636
23640
  const roundParityValue = (value) => {
23637
23641
  if (typeof value !== "number") return value;
23638
23642
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24446,7 +24450,7 @@ class PixldocsRenderer {
24446
24450
  await this.waitForCanvasScene(container, cloned, i);
24447
24451
  }
24448
24452
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24449
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BLNaGpPE.cjs"));
24453
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DqdRBbl_.cjs"));
24450
24454
  const prepared = preparePagesForExport(
24451
24455
  cloned.pages,
24452
24456
  canvasWidth,
@@ -26766,7 +26770,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26766
26770
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26767
26771
  sanitizeSvgTreeForPdf(svgToDraw);
26768
26772
  try {
26769
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BLNaGpPE.cjs"));
26773
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DqdRBbl_.cjs"));
26770
26774
  try {
26771
26775
  await logTextMeasurementDiagnostic(svgToDraw);
26772
26776
  } catch {
@@ -27163,4 +27167,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27163
27167
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27164
27168
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27165
27169
  exports.warmTemplateFromForm = warmTemplateFromForm;
27166
- //# sourceMappingURL=index-CqoBp7NY.cjs.map
27170
+ //# sourceMappingURL=index-4L9uZ78v.cjs.map