@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.
@@ -12204,6 +12204,7 @@ const PageCanvas = react.forwardRef(
12204
12204
  const preserveSelectionAfterTransformIdRef = react.useRef(null);
12205
12205
  const groupSelectionTransformStartRef = react.useRef(null);
12206
12206
  const activeSelectionMoveStartRef = react.useRef(null);
12207
+ const lastLiveSelectionRectRef = react.useRef(null);
12207
12208
  const sectionGroupTransientImagesRef = react.useRef(null);
12208
12209
  setGroupOverlayLiveBoundsRef.current = setGroupOverlayLiveBounds;
12209
12210
  const {
@@ -13161,6 +13162,7 @@ const PageCanvas = react.forwardRef(
13161
13162
  fabricCanvas.on("mouse:down", () => {
13162
13163
  groupSelectionTransformStartRef.current = null;
13163
13164
  activeSelectionMoveStartRef.current = null;
13165
+ lastLiveSelectionRectRef.current = null;
13164
13166
  activeSelectionResizeHandleRef.current = null;
13165
13167
  const active = fabricCanvas.getActiveObject();
13166
13168
  if (active instanceof fabric__namespace.ActiveSelection) {
@@ -13340,6 +13342,17 @@ const PageCanvas = react.forwardRef(
13340
13342
  }
13341
13343
  const active = fabricCanvas.getActiveObject();
13342
13344
  if (!active) return;
13345
+ if (active instanceof fabric__namespace.ActiveSelection) {
13346
+ try {
13347
+ const liveRect = active.getBoundingRect();
13348
+ lastLiveSelectionRectRef.current = {
13349
+ selection: active,
13350
+ left: liveRect.left,
13351
+ top: liveRect.top
13352
+ };
13353
+ } catch {
13354
+ }
13355
+ }
13343
13356
  const state = useEditorStore.getState();
13344
13357
  const canvasPage = (_b2 = state.canvas.pages) == null ? void 0 : _b2.find((p) => p.id === pageId);
13345
13358
  const children = (canvasPage == null ? void 0 : canvasPage.children) ?? [];
@@ -15960,7 +15973,8 @@ const PageCanvas = react.forwardRef(
15960
15973
  let activeObjects = fabricCanvas.getActiveObjects();
15961
15974
  const activeSelectionMoveStart = activeObj instanceof fabric__namespace.ActiveSelection && ((_g = activeSelectionMoveStartRef.current) == null ? void 0 : _g.selection) === activeObj ? activeSelectionMoveStartRef.current : null;
15962
15975
  const activeSelectionDelta = activeObj instanceof fabric__namespace.ActiveSelection && activeSelectionMoveStart ? (() => {
15963
- const rect = activeObj.getBoundingRect();
15976
+ const live = lastLiveSelectionRectRef.current;
15977
+ const rect = live && live.selection === activeObj ? { left: live.left, top: live.top } : activeObj.getBoundingRect();
15964
15978
  return {
15965
15979
  x: rect.left - activeSelectionMoveStart.selectionLeft,
15966
15980
  y: rect.top - activeSelectionMoveStart.selectionTop
@@ -16080,7 +16094,8 @@ const PageCanvas = react.forwardRef(
16080
16094
  let movedGroupLeft = groupAbs.left;
16081
16095
  let movedGroupTop = groupAbs.top;
16082
16096
  if (activeObj instanceof fabric__namespace.ActiveSelection && (transformStart == null ? void 0 : transformStart.groupId) === groupToMove.id) {
16083
- const selectionRect = activeObj.getBoundingRect();
16097
+ const live = lastLiveSelectionRectRef.current;
16098
+ const selectionRect = live && live.selection === activeObj ? { left: live.left, top: live.top } : activeObj.getBoundingRect();
16084
16099
  movedGroupLeft = transformStart.groupLeft + (selectionRect.left - transformStart.selectionLeft);
16085
16100
  movedGroupTop = transformStart.groupTop + (selectionRect.top - transformStart.selectionTop);
16086
16101
  } else if (activeObj instanceof fabric__namespace.ActiveSelection && firstId && firstObj) {
@@ -26420,9 +26435,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26420
26435
  }
26421
26436
  return svgString;
26422
26437
  }
26423
- const resolvedPackageVersion = "0.5.485";
26438
+ const resolvedPackageVersion = "0.5.486";
26424
26439
  const PACKAGE_VERSION = resolvedPackageVersion;
26425
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.485";
26440
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.486";
26426
26441
  const roundParityValue = (value) => {
26427
26442
  if (typeof value !== "number") return value;
26428
26443
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27236,7 +27251,7 @@ class PixldocsRenderer {
27236
27251
  await this.waitForCanvasScene(container, cloned, i);
27237
27252
  }
27238
27253
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27239
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-pylbB5Ls.cjs"));
27254
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BepYq3oJ.cjs"));
27240
27255
  const prepared = preparePagesForExport(
27241
27256
  cloned.pages,
27242
27257
  canvasWidth,
@@ -29556,7 +29571,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29556
29571
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29557
29572
  sanitizeSvgTreeForPdf(svgToDraw);
29558
29573
  try {
29559
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-pylbB5Ls.cjs"));
29574
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BepYq3oJ.cjs"));
29560
29575
  try {
29561
29576
  await logTextMeasurementDiagnostic(svgToDraw);
29562
29577
  } catch {
@@ -29870,4 +29885,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29870
29885
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29871
29886
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29872
29887
  exports.warmTemplateFromForm = warmTemplateFromForm;
29873
- //# sourceMappingURL=index-DG8BpcY2.cjs.map
29888
+ //# sourceMappingURL=index-smRSw8bm.cjs.map