@pixldocs/canvas-renderer 0.5.385 → 0.5.386

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,54 @@ const PageCanvas = forwardRef(
14299
14299
  continue;
14300
14300
  }
14301
14301
  if (!(child instanceof fabric.Textbox)) continue;
14302
+ const childAngleDeg = child.angle ?? 0;
14303
+ const asSx = isXSide ? sAxis : 1;
14304
+ const asSy = isXSide ? 1 : sAxis;
14305
+ const theta = fabric.util.degreesToRadians(childAngleDeg);
14306
+ const cosT = Math.cos(theta);
14307
+ const sinT = Math.sin(theta);
14302
14308
  if (isXSide) {
14303
14309
  if (child.__asLiveOrigW == null) {
14304
14310
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14305
14311
  }
14306
14312
  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
- }
14313
+ const sLocalX = asSx * cosT * cosT + sinT * sinT;
14314
+ const newW = Math.max(20, origW * sLocalX);
14315
+ child._set("width", newW);
14319
14316
  } else {
14320
14317
  if (child.__asLiveOrigH == null) {
14321
14318
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14322
14319
  }
14323
14320
  const origH = child.__asLiveOrigH;
14324
- const newH = Math.max(20, origH * sAxis);
14321
+ const sLocalY = asSy * cosT * cosT + sinT * sinT;
14322
+ const newH = Math.max(20, origH * sLocalY);
14325
14323
  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
14324
  }
14325
+ try {
14326
+ const inv = [1 / asSx, 0, 0, 1 / asSy, 0, 0];
14327
+ const Rtheta = fabric.util.composeMatrix({
14328
+ angle: childAngleDeg,
14329
+ scaleX: 1,
14330
+ scaleY: 1,
14331
+ translateX: 0,
14332
+ translateY: 0
14333
+ });
14334
+ const M = fabric.util.multiplyTransformMatrices(inv, Rtheta);
14335
+ const dec = fabric.util.qrDecompose(M);
14336
+ child._set("angle", dec.angle);
14337
+ child._set("scaleX", dec.scaleX);
14338
+ child._set("scaleY", dec.scaleY);
14339
+ child._set("skewX", dec.skewX);
14340
+ child._set("skewY", dec.skewY);
14341
+ } catch {
14342
+ }
14343
+ try {
14344
+ child.initDimensions();
14345
+ } catch {
14346
+ }
14347
+ child.setCoords();
14348
+ child.dirty = true;
14349
+ didReflowTextChild = true;
14335
14350
  }
14336
14351
  if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14337
14352
  const snap = groupShiftReflowSnapshotRef.current;
@@ -24863,9 +24878,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24863
24878
  }
24864
24879
  return svgString;
24865
24880
  }
24866
- const resolvedPackageVersion = "0.5.385";
24881
+ const resolvedPackageVersion = "0.5.386";
24867
24882
  const PACKAGE_VERSION = resolvedPackageVersion;
24868
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.385";
24883
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.386";
24869
24884
  const roundParityValue = (value) => {
24870
24885
  if (typeof value !== "number") return value;
24871
24886
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25679,7 +25694,7 @@ class PixldocsRenderer {
25679
25694
  await this.waitForCanvasScene(container, cloned, i);
25680
25695
  }
25681
25696
  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");
25697
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CuXE8W_Q.js");
25683
25698
  const prepared = preparePagesForExport(
25684
25699
  cloned.pages,
25685
25700
  canvasWidth,
@@ -27999,7 +28014,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27999
28014
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28000
28015
  sanitizeSvgTreeForPdf(svgToDraw);
28001
28016
  try {
28002
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CqGfBDhF.js");
28017
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CuXE8W_Q.js");
28003
28018
  try {
28004
28019
  await logTextMeasurementDiagnostic(svgToDraw);
28005
28020
  } catch {
@@ -28399,4 +28414,4 @@ export {
28399
28414
  buildTeaserBlurFlatKeys as y,
28400
28415
  collectFontDescriptorsFromConfig as z
28401
28416
  };
28402
- //# sourceMappingURL=index-Y4ydIPau.js.map
28417
+ //# sourceMappingURL=index-BBprK5c2.js.map