@pixldocs/canvas-renderer 0.5.485 → 0.5.486

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.
@@ -12186,6 +12186,7 @@ const PageCanvas = forwardRef(
12186
12186
  const preserveSelectionAfterTransformIdRef = useRef(null);
12187
12187
  const groupSelectionTransformStartRef = useRef(null);
12188
12188
  const activeSelectionMoveStartRef = useRef(null);
12189
+ const lastLiveSelectionRectRef = useRef(null);
12189
12190
  const sectionGroupTransientImagesRef = useRef(null);
12190
12191
  setGroupOverlayLiveBoundsRef.current = setGroupOverlayLiveBounds;
12191
12192
  const {
@@ -13143,6 +13144,7 @@ const PageCanvas = forwardRef(
13143
13144
  fabricCanvas.on("mouse:down", () => {
13144
13145
  groupSelectionTransformStartRef.current = null;
13145
13146
  activeSelectionMoveStartRef.current = null;
13147
+ lastLiveSelectionRectRef.current = null;
13146
13148
  activeSelectionResizeHandleRef.current = null;
13147
13149
  const active = fabricCanvas.getActiveObject();
13148
13150
  if (active instanceof fabric.ActiveSelection) {
@@ -13322,6 +13324,17 @@ const PageCanvas = forwardRef(
13322
13324
  }
13323
13325
  const active = fabricCanvas.getActiveObject();
13324
13326
  if (!active) return;
13327
+ if (active instanceof fabric.ActiveSelection) {
13328
+ try {
13329
+ const liveRect = active.getBoundingRect();
13330
+ lastLiveSelectionRectRef.current = {
13331
+ selection: active,
13332
+ left: liveRect.left,
13333
+ top: liveRect.top
13334
+ };
13335
+ } catch {
13336
+ }
13337
+ }
13325
13338
  const state = useEditorStore.getState();
13326
13339
  const canvasPage = (_b2 = state.canvas.pages) == null ? void 0 : _b2.find((p) => p.id === pageId);
13327
13340
  const children = (canvasPage == null ? void 0 : canvasPage.children) ?? [];
@@ -15942,7 +15955,8 @@ const PageCanvas = forwardRef(
15942
15955
  let activeObjects = fabricCanvas.getActiveObjects();
15943
15956
  const activeSelectionMoveStart = activeObj instanceof fabric.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
15944
15957
  const activeSelectionDelta = activeObj instanceof fabric.ActiveSelection && activeSelectionMoveStart ? (() => {
15945
- const rect = activeObj.getBoundingRect();
15958
+ const live = lastLiveSelectionRectRef.current;
15959
+ const rect = live && live.selection === activeObj ? { left: live.left, top: live.top } : activeObj.getBoundingRect();
15946
15960
  return {
15947
15961
  x: rect.left - activeSelectionMoveStart.selectionLeft,
15948
15962
  y: rect.top - activeSelectionMoveStart.selectionTop
@@ -16062,7 +16076,8 @@ const PageCanvas = forwardRef(
16062
16076
  let movedGroupLeft = groupAbs.left;
16063
16077
  let movedGroupTop = groupAbs.top;
16064
16078
  if (activeObj instanceof fabric.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
16065
- const selectionRect = activeObj.getBoundingRect();
16079
+ const live = lastLiveSelectionRectRef.current;
16080
+ const selectionRect = live && live.selection === activeObj ? { left: live.left, top: live.top } : activeObj.getBoundingRect();
16066
16081
  movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
16067
16082
  movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
16068
16083
  } else if (activeObj instanceof fabric.ActiveSelection && firstId && firstObj) {
@@ -26402,9 +26417,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26402
26417
  }
26403
26418
  return svgString;
26404
26419
  }
26405
- const resolvedPackageVersion = "0.5.485";
26420
+ const resolvedPackageVersion = "0.5.486";
26406
26421
  const PACKAGE_VERSION = resolvedPackageVersion;
26407
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.485";
26422
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.486";
26408
26423
  const roundParityValue = (value) => {
26409
26424
  if (typeof value !== "number") return value;
26410
26425
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27218,7 +27233,7 @@ class PixldocsRenderer {
27218
27233
  await this.waitForCanvasScene(container, cloned, i);
27219
27234
  }
27220
27235
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27221
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BaxoJICy.js");
27236
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DnsSdLBw.js");
27222
27237
  const prepared = preparePagesForExport(
27223
27238
  cloned.pages,
27224
27239
  canvasWidth,
@@ -29538,7 +29553,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29538
29553
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29539
29554
  sanitizeSvgTreeForPdf(svgToDraw);
29540
29555
  try {
29541
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BaxoJICy.js");
29556
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DnsSdLBw.js");
29542
29557
  try {
29543
29558
  await logTextMeasurementDiagnostic(svgToDraw);
29544
29559
  } catch {
@@ -29855,4 +29870,4 @@ export {
29855
29870
  buildTeaserBlurFlatKeys as y,
29856
29871
  collectFontDescriptorsFromConfig as z
29857
29872
  };
29858
- //# sourceMappingURL=index-BPh2zj_A.js.map
29873
+ //# sourceMappingURL=index-CahlaWb5.js.map