@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.
@@ -11230,6 +11230,26 @@ const PageCanvas = forwardRef(
11230
11230
  hoveredGroupId
11231
11231
  } = useEditorStore();
11232
11232
  const storeSelectedIds = canvas.selectedIds ?? [];
11233
+ const restoreGroupSelectionSnapshot = useCallback((snapshot) => {
11234
+ const fc = fabricRef.current;
11235
+ const groupId = snapshot == null ? void 0 : snapshot.groupSelectionId;
11236
+ if (!fc || !groupId || snapshot.memberIds.length < 2 || editingTextIdRef.current) return;
11237
+ const members = snapshot.memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
11238
+ if (members.length < 2) return;
11239
+ isSyncingSelectionToFabricRef.current = true;
11240
+ try {
11241
+ const active = fc.getActiveObject();
11242
+ const selection = active instanceof fabric.ActiveSelection && members.every((member) => active.getObjects().includes(member)) ? active : new fabric.ActiveSelection(members, { canvas: fc });
11243
+ applyLogicalGroupSelectionVisualState(selection, groupId);
11244
+ fc.setActiveObject(selection);
11245
+ selection.setCoords();
11246
+ fc.requestRenderAll();
11247
+ } finally {
11248
+ requestAnimationFrame(() => {
11249
+ isSyncingSelectionToFabricRef.current = false;
11250
+ });
11251
+ }
11252
+ }, [applyLogicalGroupSelectionVisualState]);
11233
11253
  const currentPage = useMemo(() => (canvas.pages ?? []).find((p) => p.id === pageId), [canvas.pages, pageId]);
11234
11254
  useMemo(() => {
11235
11255
  const ids = storeSelectedIds ?? [];
@@ -12684,32 +12704,11 @@ const PageCanvas = forwardRef(
12684
12704
  const restorePreservedGroupSelectionSoon = (snapshot = preserveActiveSelectionAfterTransformRef.current) => {
12685
12705
  if (!(snapshot == null ? void 0 : snapshot.groupSelectionId) || snapshot.memberIds.length < 2) return;
12686
12706
  const groupId = snapshot.groupSelectionId;
12687
- const memberIds = [...snapshot.memberIds];
12688
12707
  selectElements([groupId], false, false);
12689
12708
  requestAnimationFrame(() => {
12690
12709
  setTimeout(() => {
12691
- const fc = fabricRef.current;
12692
- if (!fc || !isActiveRef.current || editingTextIdRef.current) return;
12693
- const active = fc.getActiveObject();
12694
- if (active instanceof fabric.ActiveSelection && active.__pixldocsGroupSelection === groupId) {
12695
- restoreGroupSelectionVisualState(active, groupId);
12696
- fc.requestRenderAll();
12697
- return;
12698
- }
12699
- const members = memberIds.map((id) => fc.getObjects().find((o) => getObjectId(o) === id)).filter((o) => !!o);
12700
- if (members.length < 2) return;
12701
- isSyncingSelectionToFabricRef.current = true;
12702
- try {
12703
- const selection = new fabric.ActiveSelection(members, { canvas: fc });
12704
- restoreGroupSelectionVisualState(selection, groupId);
12705
- fc.setActiveObject(selection);
12706
- selection.setCoords();
12707
- fc.requestRenderAll();
12708
- } finally {
12709
- requestAnimationFrame(() => {
12710
- isSyncingSelectionToFabricRef.current = false;
12711
- });
12712
- }
12710
+ if (!isActiveRef.current) return;
12711
+ restoreGroupSelectionSnapshot(snapshot);
12713
12712
  }, 0);
12714
12713
  });
12715
12714
  };
@@ -13179,7 +13178,8 @@ const PageCanvas = forwardRef(
13179
13178
  if (memberIds.length > 1) {
13180
13179
  restorePreservedGroupSelectionSoon({
13181
13180
  memberIds,
13182
- groupSelectionId: pendingDrillIn.groupId
13181
+ groupSelectionId: pendingDrillIn.groupId,
13182
+ expiresAt: Date.now() + 1200
13183
13183
  });
13184
13184
  } else {
13185
13185
  selectElements([pendingDrillIn.groupId], false, false);
@@ -15689,6 +15689,10 @@ const PageCanvas = forwardRef(
15689
15689
  }
15690
15690
  }
15691
15691
  }
15692
+ const recentGroupRestore = recentGroupSelectionRestoreRef.current;
15693
+ if ((recentGroupRestore == null ? void 0 : recentGroupRestore.groupSelectionId) && recentGroupRestore.expiresAt > Date.now()) {
15694
+ restoreGroupSelectionSnapshot(recentGroupRestore);
15695
+ }
15692
15696
  preserveSelectionAfterTransformIdRef.current = null;
15693
15697
  preserveActiveSelectionAfterTransformRef.current = null;
15694
15698
  syncTriggeredByPanelRef.current = false;
@@ -23612,9 +23616,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
23612
23616
  }
23613
23617
  return svgString;
23614
23618
  }
23615
- const resolvedPackageVersion = "0.5.285";
23619
+ const resolvedPackageVersion = "0.5.286";
23616
23620
  const PACKAGE_VERSION = resolvedPackageVersion;
23617
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.285";
23621
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.286";
23618
23622
  const roundParityValue = (value) => {
23619
23623
  if (typeof value !== "number") return value;
23620
23624
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -24428,7 +24432,7 @@ class PixldocsRenderer {
24428
24432
  await this.waitForCanvasScene(container, cloned, i);
24429
24433
  }
24430
24434
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
24431
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-B0C--0iz.js");
24435
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-wObaRY6z.js");
24432
24436
  const prepared = preparePagesForExport(
24433
24437
  cloned.pages,
24434
24438
  canvasWidth,
@@ -26748,7 +26752,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
26748
26752
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
26749
26753
  sanitizeSvgTreeForPdf(svgToDraw);
26750
26754
  try {
26751
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-B0C--0iz.js");
26755
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-wObaRY6z.js");
26752
26756
  try {
26753
26757
  await logTextMeasurementDiagnostic(svgToDraw);
26754
26758
  } catch {
@@ -27148,4 +27152,4 @@ export {
27148
27152
  buildTeaserBlurFlatKeys as y,
27149
27153
  collectFontDescriptorsFromConfig as z
27150
27154
  };
27151
- //# sourceMappingURL=index-3k0uE4wB.js.map
27155
+ //# sourceMappingURL=index-EkY5XEkR.js.map