@pixldocs/canvas-renderer 0.5.415 → 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,14 @@ 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 worldAngle = (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;
15792
+ const worldAngle = liveWorldAngle;
15775
15793
  absoluteLeft = worldCx - finalWidth / 2;
15776
15794
  absoluteTop = worldCy - finalHeight / 2;
15777
15795
  finalAbsoluteMatrix = fabric.util.composeMatrix({
@@ -15894,13 +15912,13 @@ const PageCanvas = forwardRef(
15894
15912
  obj.setCoords();
15895
15913
  } catch {
15896
15914
  }
15897
- finalWidth = bakedW;
15898
- finalHeight = bakedH;
15915
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
15916
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
15899
15917
  finalScaleX = 1;
15900
15918
  finalScaleY = 1;
15901
- const worldCx = decomposed.translateX ?? 0;
15902
- const worldCy = decomposed.translateY ?? 0;
15903
- const worldAngleI = (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;
15904
15922
  absoluteLeft = worldCx - finalWidth / 2;
15905
15923
  absoluteTop = worldCy - finalHeight / 2;
15906
15924
  finalAbsoluteMatrix = fabric.util.composeMatrix({
@@ -16250,11 +16268,13 @@ const PageCanvas = forwardRef(
16250
16268
  const isRotatedImg = Math.min(normAng, 360 - normAng) > 0.5;
16251
16269
  if (isRotatedImg && activeObj instanceof fabric.ActiveSelection) {
16252
16270
  try {
16253
- const cleanAngleI = childLocalAngleSrc;
16254
- const cleanW = Math.max(1, Number(elementUpdate.width ?? finalWidth));
16255
- const cleanH = Math.max(1, Number(elementUpdate.height ?? finalHeight));
16256
- const cx = decomposed.translateX ?? absoluteLeft + cleanW / 2;
16257
- const cy = decomposed.translateY ?? absoluteTop + cleanH / 2;
16271
+ const parentWorldAngle = activeObj.angle ?? 0;
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;
16258
16278
  const thetaI = fabric.util.degreesToRadians(cleanAngleI);
16259
16279
  const cosI = Math.cos(thetaI);
16260
16280
  const sinI = Math.sin(thetaI);
@@ -16448,6 +16468,12 @@ const PageCanvas = forwardRef(
16448
16468
  if (t instanceof fabric.ActiveSelection) {
16449
16469
  for (const child of t.getObjects()) {
16450
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;
16451
16477
  }
16452
16478
  }
16453
16479
  } catch {
@@ -25519,9 +25545,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25519
25545
  }
25520
25546
  return svgString;
25521
25547
  }
25522
- const resolvedPackageVersion = "0.5.415";
25548
+ const resolvedPackageVersion = "0.5.417";
25523
25549
  const PACKAGE_VERSION = resolvedPackageVersion;
25524
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.415";
25550
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.417";
25525
25551
  const roundParityValue = (value) => {
25526
25552
  if (typeof value !== "number") return value;
25527
25553
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26335,7 +26361,7 @@ class PixldocsRenderer {
26335
26361
  await this.waitForCanvasScene(container, cloned, i);
26336
26362
  }
26337
26363
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26338
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-Db2vIeqx.js");
26364
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DU4hhl6N.js");
26339
26365
  const prepared = preparePagesForExport(
26340
26366
  cloned.pages,
26341
26367
  canvasWidth,
@@ -28655,7 +28681,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28655
28681
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28656
28682
  sanitizeSvgTreeForPdf(svgToDraw);
28657
28683
  try {
28658
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-Db2vIeqx.js");
28684
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DU4hhl6N.js");
28659
28685
  try {
28660
28686
  await logTextMeasurementDiagnostic(svgToDraw);
28661
28687
  } catch {
@@ -29055,4 +29081,4 @@ export {
29055
29081
  buildTeaserBlurFlatKeys as y,
29056
29082
  collectFontDescriptorsFromConfig as z
29057
29083
  };
29058
- //# sourceMappingURL=index-B2-9Hojr.js.map
29084
+ //# sourceMappingURL=index-BcP1ewWF.js.map