@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.
@@ -14317,39 +14317,57 @@ const PageCanvas = react.forwardRef(
14317
14317
  continue;
14318
14318
  }
14319
14319
  if (!(child instanceof fabric__namespace.Textbox)) continue;
14320
+ if (child.__asLiveOrigAngle == null) {
14321
+ child.__asLiveOrigAngle = child.angle ?? 0;
14322
+ }
14323
+ const childAngleDeg = child.__asLiveOrigAngle;
14324
+ const asSx = isXSide ? sAxis : 1;
14325
+ const asSy = isXSide ? 1 : sAxis;
14326
+ const theta = fabric__namespace.util.degreesToRadians(childAngleDeg);
14327
+ const cosT = Math.cos(theta);
14328
+ const sinT = Math.sin(theta);
14320
14329
  if (isXSide) {
14321
14330
  if (child.__asLiveOrigW == null) {
14322
14331
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14323
14332
  }
14324
14333
  const origW = child.__asLiveOrigW;
14325
- const newW = Math.max(20, origW * sAxis);
14326
- if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14327
- child._set("width", newW);
14328
- child._set("scaleX", 1 / sAxis);
14329
- try {
14330
- child.initDimensions();
14331
- } catch {
14332
- }
14333
- child.setCoords();
14334
- child.dirty = true;
14335
- didReflowTextChild = true;
14336
- }
14334
+ const sLocalX = asSx * cosT * cosT + sinT * sinT;
14335
+ const newW = Math.max(20, origW * sLocalX);
14336
+ child._set("width", newW);
14337
14337
  } else {
14338
14338
  if (child.__asLiveOrigH == null) {
14339
14339
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14340
14340
  }
14341
14341
  const origH = child.__asLiveOrigH;
14342
- const newH = Math.max(20, origH * sAxis);
14342
+ const sLocalY = asSy * cosT * cosT + sinT * sinT;
14343
+ const newH = Math.max(20, origH * sLocalY);
14343
14344
  child.minBoxHeight = newH;
14344
- child._set("scaleY", 1 / sAxis);
14345
- try {
14346
- child.initDimensions();
14347
- } catch {
14348
- }
14349
- child.setCoords();
14350
- child.dirty = true;
14351
- didReflowTextChild = true;
14352
14345
  }
14346
+ try {
14347
+ const inv = [1 / asSx, 0, 0, 1 / asSy, 0, 0];
14348
+ const Rtheta = fabric__namespace.util.composeMatrix({
14349
+ angle: childAngleDeg,
14350
+ scaleX: 1,
14351
+ scaleY: 1,
14352
+ translateX: 0,
14353
+ translateY: 0
14354
+ });
14355
+ const M = fabric__namespace.util.multiplyTransformMatrices(inv, Rtheta);
14356
+ const dec = fabric__namespace.util.qrDecompose(M);
14357
+ child._set("angle", dec.angle);
14358
+ child._set("scaleX", dec.scaleX);
14359
+ child._set("scaleY", dec.scaleY);
14360
+ child._set("skewX", dec.skewX);
14361
+ child._set("skewY", dec.skewY);
14362
+ } catch {
14363
+ }
14364
+ try {
14365
+ child.initDimensions();
14366
+ } catch {
14367
+ }
14368
+ child.setCoords();
14369
+ child.dirty = true;
14370
+ didReflowTextChild = true;
14353
14371
  }
14354
14372
  if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14355
14373
  const snap = groupShiftReflowSnapshotRef.current;
@@ -14734,6 +14752,7 @@ const PageCanvas = react.forwardRef(
14734
14752
  delete child.__asLiveOrigW;
14735
14753
  delete child.__asLiveOrigH;
14736
14754
  delete child.__asLiveRotSnap;
14755
+ delete child.__asLiveOrigAngle;
14737
14756
  }
14738
14757
  }
14739
14758
  } catch {
@@ -24881,9 +24900,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24881
24900
  }
24882
24901
  return svgString;
24883
24902
  }
24884
- const resolvedPackageVersion = "0.5.385";
24903
+ const resolvedPackageVersion = "0.5.387";
24885
24904
  const PACKAGE_VERSION = resolvedPackageVersion;
24886
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.385";
24905
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.387";
24887
24906
  const roundParityValue = (value) => {
24888
24907
  if (typeof value !== "number") return value;
24889
24908
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25697,7 +25716,7 @@ class PixldocsRenderer {
25697
25716
  await this.waitForCanvasScene(container, cloned, i);
25698
25717
  }
25699
25718
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25700
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-PfyXnorA.cjs"));
25719
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-C_LKrBRO.cjs"));
25701
25720
  const prepared = preparePagesForExport(
25702
25721
  cloned.pages,
25703
25722
  canvasWidth,
@@ -28017,7 +28036,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28017
28036
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28018
28037
  sanitizeSvgTreeForPdf(svgToDraw);
28019
28038
  try {
28020
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-PfyXnorA.cjs"));
28039
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-C_LKrBRO.cjs"));
28021
28040
  try {
28022
28041
  await logTextMeasurementDiagnostic(svgToDraw);
28023
28042
  } catch {
@@ -28414,4 +28433,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28414
28433
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28415
28434
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28416
28435
  exports.warmTemplateFromForm = warmTemplateFromForm;
28417
- //# sourceMappingURL=index-BoNuF4Yx.cjs.map
28436
+ //# sourceMappingURL=index-C76ELpPn.cjs.map