@pixldocs/canvas-renderer 0.5.388 → 0.5.389

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.
@@ -14312,23 +14312,26 @@ const PageCanvas = forwardRef(
14312
14312
  if (child instanceof fabric.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
14313
14313
  const ct = child.__cropData;
14314
14314
  if (!ct) continue;
14315
+ if (child.__asLiveOrigAngle == null) {
14316
+ child.__asLiveOrigAngle = child.angle ?? 0;
14317
+ }
14318
+ const childAngleDegC = child.__asLiveOrigAngle;
14319
+ const asSxC = isXSide ? sAxis : 1;
14320
+ const asSyC = isXSide ? 1 : sAxis;
14321
+ const thetaC = fabric.util.degreesToRadians(childAngleDegC);
14322
+ const cosTC = Math.cos(thetaC);
14323
+ const sinTC = Math.sin(thetaC);
14324
+ const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
14315
14325
  if (isXSide) {
14316
14326
  if (child.__asLiveOrigW == null) {
14317
14327
  const baseW = child.width ?? ct.frameW ?? 0;
14318
14328
  child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
14319
14329
  }
14320
14330
  const origW = child.__asLiveOrigW;
14321
- const newW = Math.max(20, origW * sAxis);
14331
+ const newW = Math.max(20, origW * sLocalC);
14322
14332
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14323
14333
  ct.frameW = newW;
14324
14334
  child._set("width", newW);
14325
- child._set("scaleX", 1 / sAxis);
14326
- try {
14327
- updateCoverLayout(child);
14328
- } catch {
14329
- }
14330
- child.setCoords();
14331
- child.dirty = true;
14332
14335
  }
14333
14336
  } else {
14334
14337
  if (child.__asLiveOrigH == null) {
@@ -14336,47 +14339,88 @@ const PageCanvas = forwardRef(
14336
14339
  child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
14337
14340
  }
14338
14341
  const origH = child.__asLiveOrigH;
14339
- const newH = Math.max(20, origH * sAxis);
14342
+ const newH = Math.max(20, origH * sLocalC);
14340
14343
  if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14341
14344
  ct.frameH = newH;
14342
14345
  child._set("height", newH);
14343
- child._set("scaleY", 1 / sAxis);
14344
- try {
14345
- updateCoverLayout(child);
14346
- } catch {
14347
- }
14348
- child.setCoords();
14349
- child.dirty = true;
14350
14346
  }
14351
14347
  }
14348
+ try {
14349
+ const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
14350
+ const RthetaC = fabric.util.composeMatrix({
14351
+ angle: childAngleDegC,
14352
+ scaleX: 1,
14353
+ scaleY: 1,
14354
+ translateX: 0,
14355
+ translateY: 0
14356
+ });
14357
+ const MC = fabric.util.multiplyTransformMatrices(invC, RthetaC);
14358
+ const decC = fabric.util.qrDecompose(MC);
14359
+ child._set("angle", decC.angle);
14360
+ child._set("scaleX", decC.scaleX);
14361
+ child._set("scaleY", decC.scaleY);
14362
+ child._set("skewX", decC.skewX);
14363
+ child._set("skewY", decC.skewY);
14364
+ } catch {
14365
+ }
14366
+ try {
14367
+ updateCoverLayout(child);
14368
+ } catch {
14369
+ }
14370
+ child.setCoords();
14371
+ child.dirty = true;
14352
14372
  continue;
14353
14373
  }
14354
14374
  if (child instanceof fabric.FabricImage && !child.__cropGroup && !child.smartElementType) {
14375
+ if (child.__asLiveOrigAngle == null) {
14376
+ child.__asLiveOrigAngle = child.angle ?? 0;
14377
+ }
14378
+ const childAngleDegI = child.__asLiveOrigAngle;
14379
+ const asSxI = isXSide ? sAxis : 1;
14380
+ const asSyI = isXSide ? 1 : sAxis;
14381
+ const thetaI = fabric.util.degreesToRadians(childAngleDegI);
14382
+ const cosTI = Math.cos(thetaI);
14383
+ const sinTI = Math.sin(thetaI);
14384
+ const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
14355
14385
  if (isXSide) {
14356
14386
  if (child.__asLiveOrigW == null) {
14357
14387
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14358
14388
  }
14359
14389
  const origW = child.__asLiveOrigW;
14360
- const newW = Math.max(1, origW * sAxis);
14390
+ const newW = Math.max(1, origW * sLocalI);
14361
14391
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14362
14392
  child._set("width", newW);
14363
- child._set("scaleX", 1 / sAxis);
14364
- child.setCoords();
14365
- child.dirty = true;
14366
14393
  }
14367
14394
  } else {
14368
14395
  if (child.__asLiveOrigH == null) {
14369
14396
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14370
14397
  }
14371
14398
  const origH = child.__asLiveOrigH;
14372
- const newH = Math.max(1, origH * sAxis);
14399
+ const newH = Math.max(1, origH * sLocalI);
14373
14400
  if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14374
14401
  child._set("height", newH);
14375
- child._set("scaleY", 1 / sAxis);
14376
- child.setCoords();
14377
- child.dirty = true;
14378
14402
  }
14379
14403
  }
14404
+ try {
14405
+ const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
14406
+ const RthetaI = fabric.util.composeMatrix({
14407
+ angle: childAngleDegI,
14408
+ scaleX: 1,
14409
+ scaleY: 1,
14410
+ translateX: 0,
14411
+ translateY: 0
14412
+ });
14413
+ const MI = fabric.util.multiplyTransformMatrices(invI, RthetaI);
14414
+ const decI = fabric.util.qrDecompose(MI);
14415
+ child._set("angle", decI.angle);
14416
+ child._set("scaleX", decI.scaleX);
14417
+ child._set("scaleY", decI.scaleY);
14418
+ child._set("skewX", decI.skewX);
14419
+ child._set("skewY", decI.skewY);
14420
+ } catch {
14421
+ }
14422
+ child.setCoords();
14423
+ child.dirty = true;
14380
14424
  continue;
14381
14425
  }
14382
14426
  if (!(child instanceof fabric.Textbox)) continue;
@@ -24974,9 +25018,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24974
25018
  }
24975
25019
  return svgString;
24976
25020
  }
24977
- const resolvedPackageVersion = "0.5.388";
25021
+ const resolvedPackageVersion = "0.5.389";
24978
25022
  const PACKAGE_VERSION = resolvedPackageVersion;
24979
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.388";
25023
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.389";
24980
25024
  const roundParityValue = (value) => {
24981
25025
  if (typeof value !== "number") return value;
24982
25026
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25790,7 +25834,7 @@ class PixldocsRenderer {
25790
25834
  await this.waitForCanvasScene(container, cloned, i);
25791
25835
  }
25792
25836
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25793
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-txxMjll_.js");
25837
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-aeROfqEB.js");
25794
25838
  const prepared = preparePagesForExport(
25795
25839
  cloned.pages,
25796
25840
  canvasWidth,
@@ -28110,7 +28154,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28110
28154
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28111
28155
  sanitizeSvgTreeForPdf(svgToDraw);
28112
28156
  try {
28113
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-txxMjll_.js");
28157
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-aeROfqEB.js");
28114
28158
  try {
28115
28159
  await logTextMeasurementDiagnostic(svgToDraw);
28116
28160
  } catch {
@@ -28510,4 +28554,4 @@ export {
28510
28554
  buildTeaserBlurFlatKeys as y,
28511
28555
  collectFontDescriptorsFromConfig as z
28512
28556
  };
28513
- //# sourceMappingURL=index-CiGVJ3wk.js.map
28557
+ //# sourceMappingURL=index-CxeXN5KG.js.map