@pixldocs/canvas-renderer 0.5.416 → 0.5.417

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.
@@ -14592,6 +14592,21 @@ const PageCanvas = forwardRef(
14592
14592
  const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
14593
14593
  const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14594
14594
  if (sAxis > 1e-3) {
14595
+ const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
14596
+ try {
14597
+ const selectionMatrix = obj.calcTransformMatrix();
14598
+ const childMatrix = childObj.calcOwnMatrix();
14599
+ const worldMatrix = fabric.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
14600
+ const live = fabric.util.qrDecompose(worldMatrix);
14601
+ childObj.__asLiveWorldAngle = live.angle;
14602
+ childObj.__asLiveWorldCenterX = live.translateX;
14603
+ childObj.__asLiveWorldCenterY = live.translateY;
14604
+ childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
14605
+ if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
14606
+ if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
14607
+ } catch {
14608
+ }
14609
+ };
14595
14610
  if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
14596
14611
  groupShiftReflowSnapshotRef.current = null;
14597
14612
  const logicalGroupId = obj.__pixldocsGroupSelection;
@@ -14690,6 +14705,7 @@ const PageCanvas = forwardRef(
14690
14705
  } catch {
14691
14706
  }
14692
14707
  child.setCoords();
14708
+ captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
14693
14709
  child.dirty = true;
14694
14710
  continue;
14695
14711
  }
@@ -14742,6 +14758,7 @@ const PageCanvas = forwardRef(
14742
14758
  } catch {
14743
14759
  }
14744
14760
  child.setCoords();
14761
+ captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
14745
14762
  child.dirty = true;
14746
14763
  continue;
14747
14764
  }
@@ -15765,13 +15782,13 @@ const PageCanvas = forwardRef(
15765
15782
  const ownSy = Math.abs(obj.scaleY ?? 1);
15766
15783
  const newFrameW = cropIsXSide ? sourceFrameW * ownSx * sLocal : sourceFrameW * ownSx;
15767
15784
  const newFrameH = cropIsXSide ? sourceFrameH * ownSy : sourceFrameH * ownSy * sLocal;
15768
- finalWidth = Math.max(1, newFrameW);
15769
- finalHeight = Math.max(1, newFrameH);
15785
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? newFrameW));
15786
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? newFrameH));
15770
15787
  finalScaleX = 1;
15771
15788
  finalScaleY = 1;
15772
- const worldCx = decomposed.translateX ?? 0;
15773
- const worldCy = decomposed.translateY ?? 0;
15774
- const liveWorldAngle = Number.isFinite(decomposed.angle) ? decomposed.angle : (activeObj.angle ?? 0) + cropChildLocalAngle;
15789
+ const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
15790
+ const worldCy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? 0;
15791
+ const liveWorldAngle = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + cropChildLocalAngle;
15775
15792
  const worldAngle = liveWorldAngle;
15776
15793
  absoluteLeft = worldCx - finalWidth / 2;
15777
15794
  absoluteTop = worldCy - finalHeight / 2;
@@ -15895,13 +15912,13 @@ const PageCanvas = forwardRef(
15895
15912
  obj.setCoords();
15896
15913
  } catch {
15897
15914
  }
15898
- finalWidth = bakedW;
15899
- finalHeight = bakedH;
15915
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
15916
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
15900
15917
  finalScaleX = 1;
15901
15918
  finalScaleY = 1;
15902
- const worldCx = decomposed.translateX ?? 0;
15903
- const worldCy = decomposed.translateY ?? 0;
15904
- const worldAngleI = Number.isFinite(decomposed.angle) ? decomposed.angle : (activeObj.angle ?? 0) + imgChildLocalAngle;
15919
+ const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
15920
+ const worldCy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? 0;
15921
+ const worldAngleI = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + imgChildLocalAngle;
15905
15922
  absoluteLeft = worldCx - finalWidth / 2;
15906
15923
  absoluteTop = worldCy - finalHeight / 2;
15907
15924
  finalAbsoluteMatrix = fabric.util.composeMatrix({
@@ -16252,11 +16269,12 @@ const PageCanvas = forwardRef(
16252
16269
  if (isRotatedImg && activeObj instanceof fabric.ActiveSelection) {
16253
16270
  try {
16254
16271
  const parentWorldAngle = activeObj.angle ?? 0;
16255
- const cleanAngleI = Number.isFinite(decomposed.angle) ? decomposed.angle - parentWorldAngle : childLocalAngleSrc;
16256
- const cleanW = Math.max(1, Number(elementUpdate.width ?? finalWidth));
16257
- const cleanH = Math.max(1, Number(elementUpdate.height ?? finalHeight));
16258
- const cx = decomposed.translateX ?? absoluteLeft + cleanW / 2;
16259
- const cy = decomposed.translateY ?? absoluteTop + cleanH / 2;
16272
+ const liveWorldAngleI = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + childLocalAngleSrc;
16273
+ const cleanAngleI = Number.isFinite(liveWorldAngleI) ? liveWorldAngleI - parentWorldAngle : childLocalAngleSrc;
16274
+ const cleanW = Math.max(1, Number(obj.__asLiveFinalW ?? elementUpdate.width ?? finalWidth));
16275
+ const cleanH = Math.max(1, Number(obj.__asLiveFinalH ?? elementUpdate.height ?? finalHeight));
16276
+ const cx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? absoluteLeft + cleanW / 2;
16277
+ const cy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? absoluteTop + cleanH / 2;
16260
16278
  const thetaI = fabric.util.degreesToRadians(cleanAngleI);
16261
16279
  const cosI = Math.cos(thetaI);
16262
16280
  const sinI = Math.sin(thetaI);
@@ -16450,6 +16468,12 @@ const PageCanvas = forwardRef(
16450
16468
  if (t instanceof fabric.ActiveSelection) {
16451
16469
  for (const child of t.getObjects()) {
16452
16470
  delete child.__asLiveOrigAngle;
16471
+ delete child.__asLiveWorldAngle;
16472
+ delete child.__asLiveWorldCenterX;
16473
+ delete child.__asLiveWorldCenterY;
16474
+ delete child.__asLiveParentWorldAngle;
16475
+ delete child.__asLiveFinalW;
16476
+ delete child.__asLiveFinalH;
16453
16477
  }
16454
16478
  }
16455
16479
  } catch {
@@ -25521,9 +25545,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25521
25545
  }
25522
25546
  return svgString;
25523
25547
  }
25524
- const resolvedPackageVersion = "0.5.416";
25548
+ const resolvedPackageVersion = "0.5.417";
25525
25549
  const PACKAGE_VERSION = resolvedPackageVersion;
25526
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.416";
25550
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.417";
25527
25551
  const roundParityValue = (value) => {
25528
25552
  if (typeof value !== "number") return value;
25529
25553
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26337,7 +26361,7 @@ class PixldocsRenderer {
26337
26361
  await this.waitForCanvasScene(container, cloned, i);
26338
26362
  }
26339
26363
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26340
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BFThdYPo.js");
26364
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DU4hhl6N.js");
26341
26365
  const prepared = preparePagesForExport(
26342
26366
  cloned.pages,
26343
26367
  canvasWidth,
@@ -28657,7 +28681,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28657
28681
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28658
28682
  sanitizeSvgTreeForPdf(svgToDraw);
28659
28683
  try {
28660
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BFThdYPo.js");
28684
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DU4hhl6N.js");
28661
28685
  try {
28662
28686
  await logTextMeasurementDiagnostic(svgToDraw);
28663
28687
  } catch {
@@ -29057,4 +29081,4 @@ export {
29057
29081
  buildTeaserBlurFlatKeys as y,
29058
29082
  collectFontDescriptorsFromConfig as z
29059
29083
  };
29060
- //# sourceMappingURL=index-CZU1DIVy.js.map
29084
+ //# sourceMappingURL=index-BcP1ewWF.js.map