@pixldocs/canvas-renderer 0.5.484 → 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) {
@@ -18844,7 +18859,7 @@ const PageCanvas = react.forwardRef(
18844
18859
  const isLine = obj instanceof fabric__namespace.Line;
18845
18860
  if (isLine) {
18846
18861
  const lineGeometry = getLineVisualGeometry(element);
18847
- const lineSet = {
18862
+ obj.set({
18848
18863
  x1: lineGeometry.x1,
18849
18864
  y1: lineGeometry.y1,
18850
18865
  x2: lineGeometry.x2,
@@ -18854,12 +18869,10 @@ const PageCanvas = react.forwardRef(
18854
18869
  scaleY: 1,
18855
18870
  skewX: 0,
18856
18871
  skewY: 0
18857
- };
18872
+ });
18858
18873
  if (!skipPositionUpdate) {
18859
- lineSet.left = fabricPos.left;
18860
- lineSet.top = fabricPos.top;
18874
+ obj.set({ left: fabricPos.left, top: fabricPos.top });
18861
18875
  }
18862
- obj.set(lineSet);
18863
18876
  obj.setCoords();
18864
18877
  }
18865
18878
  if (!isLine) {
@@ -19368,6 +19381,8 @@ const PageCanvas = react.forwardRef(
19368
19381
  }
19369
19382
  if (isLine) {
19370
19383
  const lineGeometry = getLineVisualGeometry(element);
19384
+ const prevLeft = obj.left;
19385
+ const prevTop = obj.top;
19371
19386
  obj.set({
19372
19387
  x1: lineGeometry.x1,
19373
19388
  y1: lineGeometry.y1,
@@ -19380,6 +19395,8 @@ const PageCanvas = react.forwardRef(
19380
19395
  strokeLineJoin: "round",
19381
19396
  ...element.strokeDashArray && { strokeDashArray: element.strokeDashArray }
19382
19397
  });
19398
+ obj.set({ left: prevLeft, top: prevTop });
19399
+ obj.setCoords();
19383
19400
  }
19384
19401
  if (element.fillGradient && isGradientConfig(element.fillGradient)) {
19385
19402
  const objWidth = typeof obj.width === "number" ? obj.width : rW;
@@ -26418,9 +26435,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26418
26435
  }
26419
26436
  return svgString;
26420
26437
  }
26421
- const resolvedPackageVersion = "0.5.484";
26438
+ const resolvedPackageVersion = "0.5.486";
26422
26439
  const PACKAGE_VERSION = resolvedPackageVersion;
26423
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.484";
26440
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.486";
26424
26441
  const roundParityValue = (value) => {
26425
26442
  if (typeof value !== "number") return value;
26426
26443
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27234,7 +27251,7 @@ class PixldocsRenderer {
27234
27251
  await this.waitForCanvasScene(container, cloned, i);
27235
27252
  }
27236
27253
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27237
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-B811hVqY.cjs"));
27254
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BepYq3oJ.cjs"));
27238
27255
  const prepared = preparePagesForExport(
27239
27256
  cloned.pages,
27240
27257
  canvasWidth,
@@ -29554,7 +29571,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29554
29571
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29555
29572
  sanitizeSvgTreeForPdf(svgToDraw);
29556
29573
  try {
29557
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-B811hVqY.cjs"));
29574
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BepYq3oJ.cjs"));
29558
29575
  try {
29559
29576
  await logTextMeasurementDiagnostic(svgToDraw);
29560
29577
  } catch {
@@ -29868,4 +29885,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29868
29885
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29869
29886
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29870
29887
  exports.warmTemplateFromForm = warmTemplateFromForm;
29871
- //# sourceMappingURL=index-BtWgeifE.cjs.map
29888
+ //# sourceMappingURL=index-smRSw8bm.cjs.map