@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.
@@ -14317,39 +14317,54 @@ const PageCanvas = react.forwardRef(
14317
14317
  continue;
14318
14318
  }
14319
14319
  if (!(child instanceof fabric__namespace.Textbox)) continue;
14320
+ const childAngleDeg = child.angle ?? 0;
14321
+ const asSx = isXSide ? sAxis : 1;
14322
+ const asSy = isXSide ? 1 : sAxis;
14323
+ const theta = fabric__namespace.util.degreesToRadians(childAngleDeg);
14324
+ const cosT = Math.cos(theta);
14325
+ const sinT = Math.sin(theta);
14320
14326
  if (isXSide) {
14321
14327
  if (child.__asLiveOrigW == null) {
14322
14328
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14323
14329
  }
14324
14330
  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
- }
14331
+ const sLocalX = asSx * cosT * cosT + sinT * sinT;
14332
+ const newW = Math.max(20, origW * sLocalX);
14333
+ child._set("width", newW);
14337
14334
  } else {
14338
14335
  if (child.__asLiveOrigH == null) {
14339
14336
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14340
14337
  }
14341
14338
  const origH = child.__asLiveOrigH;
14342
- const newH = Math.max(20, origH * sAxis);
14339
+ const sLocalY = asSy * cosT * cosT + sinT * sinT;
14340
+ const newH = Math.max(20, origH * sLocalY);
14343
14341
  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
14342
  }
14343
+ try {
14344
+ const inv = [1 / asSx, 0, 0, 1 / asSy, 0, 0];
14345
+ const Rtheta = fabric__namespace.util.composeMatrix({
14346
+ angle: childAngleDeg,
14347
+ scaleX: 1,
14348
+ scaleY: 1,
14349
+ translateX: 0,
14350
+ translateY: 0
14351
+ });
14352
+ const M = fabric__namespace.util.multiplyTransformMatrices(inv, Rtheta);
14353
+ const dec = fabric__namespace.util.qrDecompose(M);
14354
+ child._set("angle", dec.angle);
14355
+ child._set("scaleX", dec.scaleX);
14356
+ child._set("scaleY", dec.scaleY);
14357
+ child._set("skewX", dec.skewX);
14358
+ child._set("skewY", dec.skewY);
14359
+ } catch {
14360
+ }
14361
+ try {
14362
+ child.initDimensions();
14363
+ } catch {
14364
+ }
14365
+ child.setCoords();
14366
+ child.dirty = true;
14367
+ didReflowTextChild = true;
14353
14368
  }
14354
14369
  if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
14355
14370
  const snap = groupShiftReflowSnapshotRef.current;
@@ -24881,9 +24896,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24881
24896
  }
24882
24897
  return svgString;
24883
24898
  }
24884
- const resolvedPackageVersion = "0.5.385";
24899
+ const resolvedPackageVersion = "0.5.386";
24885
24900
  const PACKAGE_VERSION = resolvedPackageVersion;
24886
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.385";
24901
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.386";
24887
24902
  const roundParityValue = (value) => {
24888
24903
  if (typeof value !== "number") return value;
24889
24904
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25697,7 +25712,7 @@ class PixldocsRenderer {
25697
25712
  await this.waitForCanvasScene(container, cloned, i);
25698
25713
  }
25699
25714
  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"));
25715
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Ch4wgY_V.cjs"));
25701
25716
  const prepared = preparePagesForExport(
25702
25717
  cloned.pages,
25703
25718
  canvasWidth,
@@ -28017,7 +28032,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28017
28032
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28018
28033
  sanitizeSvgTreeForPdf(svgToDraw);
28019
28034
  try {
28020
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-PfyXnorA.cjs"));
28035
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Ch4wgY_V.cjs"));
28021
28036
  try {
28022
28037
  await logTextMeasurementDiagnostic(svgToDraw);
28023
28038
  } catch {
@@ -28414,4 +28429,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28414
28429
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28415
28430
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28416
28431
  exports.warmTemplateFromForm = warmTemplateFromForm;
28417
- //# sourceMappingURL=index-BoNuF4Yx.cjs.map
28432
+ //# sourceMappingURL=index-DPK4VKN5.cjs.map