@pixldocs/canvas-renderer 0.5.385 → 0.5.387

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.
@@ -14299,39 +14299,57 @@ const PageCanvas = forwardRef(
14299
14299
  continue;
14300
14300
  }
14301
14301
  if (!(child instanceof fabric.Textbox)) continue;
14302
+ if (child.__asLiveOrigAngle == null) {
14303
+ child.__asLiveOrigAngle = child.angle ?? 0;
14304
+ }
14305
+ const childAngleDeg = child.__asLiveOrigAngle;
14306
+ const asSx = isXSide ? sAxis : 1;
14307
+ const asSy = isXSide ? 1 : sAxis;
14308
+ const theta = fabric.util.degreesToRadians(childAngleDeg);
14309
+ const cosT = Math.cos(theta);
14310
+ const sinT = Math.sin(theta);
14302
14311
  if (isXSide) {
14303
14312
  if (child.__asLiveOrigW == null) {
14304
14313
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14305
14314
  }
14306
14315
  const origW = child.__asLiveOrigW;
14307
- const newW = Math.max(20, origW * sAxis);
14308
- if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14309
- child._set("width", newW);
14310
- child._set("scaleX", 1 / sAxis);
14311
- try {
14312
- child.initDimensions();
14313
- } catch {
14314
- }
14315
- child.setCoords();
14316
- child.dirty = true;
14317
- didReflowTextChild = true;
14318
- }
14316
+ const sLocalX = asSx * cosT * cosT + sinT * sinT;
14317
+ const newW = Math.max(20, origW * sLocalX);
14318
+ child._set("width", newW);
14319
14319
  } else {
14320
14320
  if (child.__asLiveOrigH == null) {
14321
14321
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14322
14322
  }
14323
14323
  const origH = child.__asLiveOrigH;
14324
- const newH = Math.max(20, origH * sAxis);
14324
+ const sLocalY = asSy * cosT * cosT + sinT * sinT;
14325
+ const newH = Math.max(20, origH * sLocalY);
14325
14326
  child.minBoxHeight = newH;
14326
- child._set("scaleY", 1 / sAxis);
14327
- try {
14328
- child.initDimensions();
14329
- } catch {
14330
- }
14331
- child.setCoords();
14332
- child.dirty = true;
14333
- didReflowTextChild = true;
14334
14327
  }
14328
+ try {
14329
+ const inv = [1 / asSx, 0, 0, 1 / asSy, 0, 0];
14330
+ const Rtheta = fabric.util.composeMatrix({
14331
+ angle: childAngleDeg,
14332
+ scaleX: 1,
14333
+ scaleY: 1,
14334
+ translateX: 0,
14335
+ translateY: 0
14336
+ });
14337
+ const M = fabric.util.multiplyTransformMatrices(inv, Rtheta);
14338
+ const dec = fabric.util.qrDecompose(M);
14339
+ child._set("angle", dec.angle);
14340
+ child._set("scaleX", dec.scaleX);
14341
+ child._set("scaleY", dec.scaleY);
14342
+ child._set("skewX", dec.skewX);
14343
+ child._set("skewY", dec.skewY);
14344
+ } catch {
14345
+ }
14346
+ try {
14347
+ child.initDimensions();
14348
+ } catch {
14349
+ }
14350
+ child.setCoords();
14351
+ child.dirty = true;
14352
+ didReflowTextChild = true;
14335
14353
  }
14336
14354
  if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14337
14355
  const snap = groupShiftReflowSnapshotRef.current;
@@ -14716,6 +14734,7 @@ const PageCanvas = forwardRef(
14716
14734
  delete child.__asLiveOrigW;
14717
14735
  delete child.__asLiveOrigH;
14718
14736
  delete child.__asLiveRotSnap;
14737
+ delete child.__asLiveOrigAngle;
14719
14738
  }
14720
14739
  }
14721
14740
  } catch {
@@ -24863,9 +24882,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24863
24882
  }
24864
24883
  return svgString;
24865
24884
  }
24866
- const resolvedPackageVersion = "0.5.385";
24885
+ const resolvedPackageVersion = "0.5.387";
24867
24886
  const PACKAGE_VERSION = resolvedPackageVersion;
24868
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.385";
24887
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.387";
24869
24888
  const roundParityValue = (value) => {
24870
24889
  if (typeof value !== "number") return value;
24871
24890
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25679,7 +25698,7 @@ class PixldocsRenderer {
25679
25698
  await this.waitForCanvasScene(container, cloned, i);
25680
25699
  }
25681
25700
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25682
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CqGfBDhF.js");
25701
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DNhNOmXo.js");
25683
25702
  const prepared = preparePagesForExport(
25684
25703
  cloned.pages,
25685
25704
  canvasWidth,
@@ -27999,7 +28018,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27999
28018
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28000
28019
  sanitizeSvgTreeForPdf(svgToDraw);
28001
28020
  try {
28002
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CqGfBDhF.js");
28021
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DNhNOmXo.js");
28003
28022
  try {
28004
28023
  await logTextMeasurementDiagnostic(svgToDraw);
28005
28024
  } catch {
@@ -28399,4 +28418,4 @@ export {
28399
28418
  buildTeaserBlurFlatKeys as y,
28400
28419
  collectFontDescriptorsFromConfig as z
28401
28420
  };
28402
- //# sourceMappingURL=index-Y4ydIPau.js.map
28421
+ //# sourceMappingURL=index-Dojo9KpB.js.map