@pixldocs/canvas-renderer 0.5.416 → 0.5.418

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