@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.
@@ -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) {
@@ -18826,7 +18841,7 @@ const PageCanvas = forwardRef(
18826
18841
  const isLine = obj instanceof fabric.Line;
18827
18842
  if (isLine) {
18828
18843
  const lineGeometry = getLineVisualGeometry(element);
18829
- const lineSet = {
18844
+ obj.set({
18830
18845
  x1: lineGeometry.x1,
18831
18846
  y1: lineGeometry.y1,
18832
18847
  x2: lineGeometry.x2,
@@ -18836,12 +18851,10 @@ const PageCanvas = forwardRef(
18836
18851
  scaleY: 1,
18837
18852
  skewX: 0,
18838
18853
  skewY: 0
18839
- };
18854
+ });
18840
18855
  if (!skipPositionUpdate) {
18841
- lineSet.left = fabricPos.left;
18842
- lineSet.top = fabricPos.top;
18856
+ obj.set({ left: fabricPos.left, top: fabricPos.top });
18843
18857
  }
18844
- obj.set(lineSet);
18845
18858
  obj.setCoords();
18846
18859
  }
18847
18860
  if (!isLine) {
@@ -19350,6 +19363,8 @@ const PageCanvas = forwardRef(
19350
19363
  }
19351
19364
  if (isLine) {
19352
19365
  const lineGeometry = getLineVisualGeometry(element);
19366
+ const prevLeft = obj.left;
19367
+ const prevTop = obj.top;
19353
19368
  obj.set({
19354
19369
  x1: lineGeometry.x1,
19355
19370
  y1: lineGeometry.y1,
@@ -19362,6 +19377,8 @@ const PageCanvas = forwardRef(
19362
19377
  strokeLineJoin: "round",
19363
19378
  ...element.strokeDashArray && { strokeDashArray: element.strokeDashArray }
19364
19379
  });
19380
+ obj.set({ left: prevLeft, top: prevTop });
19381
+ obj.setCoords();
19365
19382
  }
19366
19383
  if (element.fillGradient && isGradientConfig(element.fillGradient)) {
19367
19384
  const objWidth = typeof obj.width === "number" ? obj.width : rW;
@@ -26400,9 +26417,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26400
26417
  }
26401
26418
  return svgString;
26402
26419
  }
26403
- const resolvedPackageVersion = "0.5.484";
26420
+ const resolvedPackageVersion = "0.5.486";
26404
26421
  const PACKAGE_VERSION = resolvedPackageVersion;
26405
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.484";
26422
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.486";
26406
26423
  const roundParityValue = (value) => {
26407
26424
  if (typeof value !== "number") return value;
26408
26425
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27216,7 +27233,7 @@ class PixldocsRenderer {
27216
27233
  await this.waitForCanvasScene(container, cloned, i);
27217
27234
  }
27218
27235
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27219
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C02bLwpw.js");
27236
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DnsSdLBw.js");
27220
27237
  const prepared = preparePagesForExport(
27221
27238
  cloned.pages,
27222
27239
  canvasWidth,
@@ -29536,7 +29553,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29536
29553
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29537
29554
  sanitizeSvgTreeForPdf(svgToDraw);
29538
29555
  try {
29539
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C02bLwpw.js");
29556
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DnsSdLBw.js");
29540
29557
  try {
29541
29558
  await logTextMeasurementDiagnostic(svgToDraw);
29542
29559
  } catch {
@@ -29853,4 +29870,4 @@ export {
29853
29870
  buildTeaserBlurFlatKeys as y,
29854
29871
  collectFontDescriptorsFromConfig as z
29855
29872
  };
29856
- //# sourceMappingURL=index-Dl4edGXt.js.map
29873
+ //# sourceMappingURL=index-CahlaWb5.js.map