@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.
@@ -14610,6 +14610,21 @@ const PageCanvas = react.forwardRef(
14610
14610
  const startSy = Math.abs(Number(((_h = _cur == null ? void 0 : _cur.original) == null ? void 0 : _h.scaleY) ?? 1)) || 1;
14611
14611
  const sAxis = isXSide ? Math.abs((obj.scaleX ?? 1) / startSx) : Math.abs((obj.scaleY ?? 1) / startSy);
14612
14612
  if (sAxis > 1e-3) {
14613
+ const captureAsLiveWorldSnapshot = (childObj, liveW, liveH) => {
14614
+ try {
14615
+ const selectionMatrix = obj.calcTransformMatrix();
14616
+ const childMatrix = childObj.calcOwnMatrix();
14617
+ const worldMatrix = fabric__namespace.util.multiplyTransformMatrices(selectionMatrix, childMatrix);
14618
+ const live = fabric__namespace.util.qrDecompose(worldMatrix);
14619
+ childObj.__asLiveWorldAngle = live.angle;
14620
+ childObj.__asLiveWorldCenterX = live.translateX;
14621
+ childObj.__asLiveWorldCenterY = live.translateY;
14622
+ childObj.__asLiveParentWorldAngle = obj.angle ?? 0;
14623
+ if (Number.isFinite(liveW)) childObj.__asLiveFinalW = liveW;
14624
+ if (Number.isFinite(liveH)) childObj.__asLiveFinalH = liveH;
14625
+ } catch {
14626
+ }
14627
+ };
14613
14628
  if (isXSide && ((_i = groupShiftReflowSnapshotRef.current) == null ? void 0 : _i.selection) !== obj) {
14614
14629
  groupShiftReflowSnapshotRef.current = null;
14615
14630
  const logicalGroupId = obj.__pixldocsGroupSelection;
@@ -14708,6 +14723,7 @@ const PageCanvas = react.forwardRef(
14708
14723
  } catch {
14709
14724
  }
14710
14725
  child.setCoords();
14726
+ captureAsLiveWorldSnapshot(child, ct.frameW ?? child.width ?? 0, ct.frameH ?? child.height ?? 0);
14711
14727
  child.dirty = true;
14712
14728
  continue;
14713
14729
  }
@@ -14760,6 +14776,7 @@ const PageCanvas = react.forwardRef(
14760
14776
  } catch {
14761
14777
  }
14762
14778
  child.setCoords();
14779
+ captureAsLiveWorldSnapshot(child, child.width ?? 0, child.height ?? 0);
14763
14780
  child.dirty = true;
14764
14781
  continue;
14765
14782
  }
@@ -15783,13 +15800,13 @@ const PageCanvas = react.forwardRef(
15783
15800
  const ownSy = Math.abs(obj.scaleY ?? 1);
15784
15801
  const newFrameW = cropIsXSide ? sourceFrameW * ownSx * sLocal : sourceFrameW * ownSx;
15785
15802
  const newFrameH = cropIsXSide ? sourceFrameH * ownSy : sourceFrameH * ownSy * sLocal;
15786
- finalWidth = Math.max(1, newFrameW);
15787
- finalHeight = Math.max(1, newFrameH);
15803
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? newFrameW));
15804
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? newFrameH));
15788
15805
  finalScaleX = 1;
15789
15806
  finalScaleY = 1;
15790
- const worldCx = decomposed.translateX ?? 0;
15791
- const worldCy = decomposed.translateY ?? 0;
15792
- const liveWorldAngle = Number.isFinite(decomposed.angle) ? decomposed.angle : (activeObj.angle ?? 0) + cropChildLocalAngle;
15807
+ const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
15808
+ const worldCy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? 0;
15809
+ const liveWorldAngle = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + cropChildLocalAngle;
15793
15810
  const worldAngle = liveWorldAngle;
15794
15811
  absoluteLeft = worldCx - finalWidth / 2;
15795
15812
  absoluteTop = worldCy - finalHeight / 2;
@@ -15913,13 +15930,13 @@ const PageCanvas = react.forwardRef(
15913
15930
  obj.setCoords();
15914
15931
  } catch {
15915
15932
  }
15916
- finalWidth = bakedW;
15917
- finalHeight = bakedH;
15933
+ finalWidth = Math.max(1, Number(obj.__asLiveFinalW ?? bakedW));
15934
+ finalHeight = Math.max(1, Number(obj.__asLiveFinalH ?? bakedH));
15918
15935
  finalScaleX = 1;
15919
15936
  finalScaleY = 1;
15920
- const worldCx = decomposed.translateX ?? 0;
15921
- const worldCy = decomposed.translateY ?? 0;
15922
- const worldAngleI = Number.isFinite(decomposed.angle) ? decomposed.angle : (activeObj.angle ?? 0) + imgChildLocalAngle;
15937
+ const worldCx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? 0;
15938
+ const worldCy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? 0;
15939
+ const worldAngleI = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + imgChildLocalAngle;
15923
15940
  absoluteLeft = worldCx - finalWidth / 2;
15924
15941
  absoluteTop = worldCy - finalHeight / 2;
15925
15942
  finalAbsoluteMatrix = fabric__namespace.util.composeMatrix({
@@ -16270,11 +16287,12 @@ const PageCanvas = react.forwardRef(
16270
16287
  if (isRotatedImg && activeObj instanceof fabric__namespace.ActiveSelection) {
16271
16288
  try {
16272
16289
  const parentWorldAngle = activeObj.angle ?? 0;
16273
- const cleanAngleI = Number.isFinite(decomposed.angle) ? decomposed.angle - parentWorldAngle : childLocalAngleSrc;
16274
- const cleanW = Math.max(1, Number(elementUpdate.width ?? finalWidth));
16275
- const cleanH = Math.max(1, Number(elementUpdate.height ?? finalHeight));
16276
- const cx = decomposed.translateX ?? absoluteLeft + cleanW / 2;
16277
- const cy = decomposed.translateY ?? absoluteTop + cleanH / 2;
16290
+ const liveWorldAngleI = Number.isFinite(obj.__asLiveWorldAngle) ? obj.__asLiveWorldAngle : (activeObj.angle ?? 0) + childLocalAngleSrc;
16291
+ const cleanAngleI = Number.isFinite(liveWorldAngleI) ? liveWorldAngleI - parentWorldAngle : childLocalAngleSrc;
16292
+ const cleanW = Math.max(1, Number(obj.__asLiveFinalW ?? elementUpdate.width ?? finalWidth));
16293
+ const cleanH = Math.max(1, Number(obj.__asLiveFinalH ?? elementUpdate.height ?? finalHeight));
16294
+ const cx = Number.isFinite(obj.__asLiveWorldCenterX) ? obj.__asLiveWorldCenterX : decomposed.translateX ?? absoluteLeft + cleanW / 2;
16295
+ const cy = Number.isFinite(obj.__asLiveWorldCenterY) ? obj.__asLiveWorldCenterY : decomposed.translateY ?? absoluteTop + cleanH / 2;
16278
16296
  const thetaI = fabric__namespace.util.degreesToRadians(cleanAngleI);
16279
16297
  const cosI = Math.cos(thetaI);
16280
16298
  const sinI = Math.sin(thetaI);
@@ -16468,6 +16486,12 @@ const PageCanvas = react.forwardRef(
16468
16486
  if (t instanceof fabric__namespace.ActiveSelection) {
16469
16487
  for (const child of t.getObjects()) {
16470
16488
  delete child.__asLiveOrigAngle;
16489
+ delete child.__asLiveWorldAngle;
16490
+ delete child.__asLiveWorldCenterX;
16491
+ delete child.__asLiveWorldCenterY;
16492
+ delete child.__asLiveParentWorldAngle;
16493
+ delete child.__asLiveFinalW;
16494
+ delete child.__asLiveFinalH;
16471
16495
  }
16472
16496
  }
16473
16497
  } catch {
@@ -25539,9 +25563,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25539
25563
  }
25540
25564
  return svgString;
25541
25565
  }
25542
- const resolvedPackageVersion = "0.5.416";
25566
+ const resolvedPackageVersion = "0.5.417";
25543
25567
  const PACKAGE_VERSION = resolvedPackageVersion;
25544
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.416";
25568
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.417";
25545
25569
  const roundParityValue = (value) => {
25546
25570
  if (typeof value !== "number") return value;
25547
25571
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -26355,7 +26379,7 @@ class PixldocsRenderer {
26355
26379
  await this.waitForCanvasScene(container, cloned, i);
26356
26380
  }
26357
26381
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
26358
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-D6fEgUkM.cjs"));
26382
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-zoXsqwIv.cjs"));
26359
26383
  const prepared = preparePagesForExport(
26360
26384
  cloned.pages,
26361
26385
  canvasWidth,
@@ -28675,7 +28699,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28675
28699
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28676
28700
  sanitizeSvgTreeForPdf(svgToDraw);
28677
28701
  try {
28678
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-D6fEgUkM.cjs"));
28702
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-zoXsqwIv.cjs"));
28679
28703
  try {
28680
28704
  await logTextMeasurementDiagnostic(svgToDraw);
28681
28705
  } catch {
@@ -29072,4 +29096,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29072
29096
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29073
29097
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29074
29098
  exports.warmTemplateFromForm = warmTemplateFromForm;
29075
- //# sourceMappingURL=index-BcxRNI0T.cjs.map
29099
+ //# sourceMappingURL=index-DejgwlrF.cjs.map