@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.
@@ -14330,23 +14330,26 @@ const PageCanvas = react.forwardRef(
14330
14330
  if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
14331
14331
  const ct = child.__cropData;
14332
14332
  if (!ct) continue;
14333
+ if (child.__asLiveOrigAngle == null) {
14334
+ child.__asLiveOrigAngle = child.angle ?? 0;
14335
+ }
14336
+ const childAngleDegC = child.__asLiveOrigAngle;
14337
+ const asSxC = isXSide ? sAxis : 1;
14338
+ const asSyC = isXSide ? 1 : sAxis;
14339
+ const thetaC = fabric__namespace.util.degreesToRadians(childAngleDegC);
14340
+ const cosTC = Math.cos(thetaC);
14341
+ const sinTC = Math.sin(thetaC);
14342
+ const sLocalC = isXSide ? asSxC * cosTC * cosTC + sinTC * sinTC : asSyC * cosTC * cosTC + sinTC * sinTC;
14333
14343
  if (isXSide) {
14334
14344
  if (child.__asLiveOrigW == null) {
14335
14345
  const baseW = child.width ?? ct.frameW ?? 0;
14336
14346
  child.__asLiveOrigW = baseW * (child.scaleX ?? 1);
14337
14347
  }
14338
14348
  const origW = child.__asLiveOrigW;
14339
- const newW = Math.max(20, origW * sAxis);
14349
+ const newW = Math.max(20, origW * sLocalC);
14340
14350
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14341
14351
  ct.frameW = newW;
14342
14352
  child._set("width", newW);
14343
- child._set("scaleX", 1 / sAxis);
14344
- try {
14345
- updateCoverLayout(child);
14346
- } catch {
14347
- }
14348
- child.setCoords();
14349
- child.dirty = true;
14350
14353
  }
14351
14354
  } else {
14352
14355
  if (child.__asLiveOrigH == null) {
@@ -14354,47 +14357,88 @@ const PageCanvas = react.forwardRef(
14354
14357
  child.__asLiveOrigH = baseH * (child.scaleY ?? 1);
14355
14358
  }
14356
14359
  const origH = child.__asLiveOrigH;
14357
- const newH = Math.max(20, origH * sAxis);
14360
+ const newH = Math.max(20, origH * sLocalC);
14358
14361
  if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14359
14362
  ct.frameH = newH;
14360
14363
  child._set("height", newH);
14361
- child._set("scaleY", 1 / sAxis);
14362
- try {
14363
- updateCoverLayout(child);
14364
- } catch {
14365
- }
14366
- child.setCoords();
14367
- child.dirty = true;
14368
14364
  }
14369
14365
  }
14366
+ try {
14367
+ const invC = [1 / asSxC, 0, 0, 1 / asSyC, 0, 0];
14368
+ const RthetaC = fabric__namespace.util.composeMatrix({
14369
+ angle: childAngleDegC,
14370
+ scaleX: 1,
14371
+ scaleY: 1,
14372
+ translateX: 0,
14373
+ translateY: 0
14374
+ });
14375
+ const MC = fabric__namespace.util.multiplyTransformMatrices(invC, RthetaC);
14376
+ const decC = fabric__namespace.util.qrDecompose(MC);
14377
+ child._set("angle", decC.angle);
14378
+ child._set("scaleX", decC.scaleX);
14379
+ child._set("scaleY", decC.scaleY);
14380
+ child._set("skewX", decC.skewX);
14381
+ child._set("skewY", decC.skewY);
14382
+ } catch {
14383
+ }
14384
+ try {
14385
+ updateCoverLayout(child);
14386
+ } catch {
14387
+ }
14388
+ child.setCoords();
14389
+ child.dirty = true;
14370
14390
  continue;
14371
14391
  }
14372
14392
  if (child instanceof fabric__namespace.FabricImage && !child.__cropGroup && !child.smartElementType) {
14393
+ if (child.__asLiveOrigAngle == null) {
14394
+ child.__asLiveOrigAngle = child.angle ?? 0;
14395
+ }
14396
+ const childAngleDegI = child.__asLiveOrigAngle;
14397
+ const asSxI = isXSide ? sAxis : 1;
14398
+ const asSyI = isXSide ? 1 : sAxis;
14399
+ const thetaI = fabric__namespace.util.degreesToRadians(childAngleDegI);
14400
+ const cosTI = Math.cos(thetaI);
14401
+ const sinTI = Math.sin(thetaI);
14402
+ const sLocalI = isXSide ? asSxI * cosTI * cosTI + sinTI * sinTI : asSyI * cosTI * cosTI + sinTI * sinTI;
14373
14403
  if (isXSide) {
14374
14404
  if (child.__asLiveOrigW == null) {
14375
14405
  child.__asLiveOrigW = (child.width ?? 0) * (child.scaleX ?? 1);
14376
14406
  }
14377
14407
  const origW = child.__asLiveOrigW;
14378
- const newW = Math.max(1, origW * sAxis);
14408
+ const newW = Math.max(1, origW * sLocalI);
14379
14409
  if (Math.abs((child.width ?? 0) - newW) > 0.5) {
14380
14410
  child._set("width", newW);
14381
- child._set("scaleX", 1 / sAxis);
14382
- child.setCoords();
14383
- child.dirty = true;
14384
14411
  }
14385
14412
  } else {
14386
14413
  if (child.__asLiveOrigH == null) {
14387
14414
  child.__asLiveOrigH = (child.height ?? 0) * (child.scaleY ?? 1);
14388
14415
  }
14389
14416
  const origH = child.__asLiveOrigH;
14390
- const newH = Math.max(1, origH * sAxis);
14417
+ const newH = Math.max(1, origH * sLocalI);
14391
14418
  if (Math.abs((child.height ?? 0) - newH) > 0.5) {
14392
14419
  child._set("height", newH);
14393
- child._set("scaleY", 1 / sAxis);
14394
- child.setCoords();
14395
- child.dirty = true;
14396
14420
  }
14397
14421
  }
14422
+ try {
14423
+ const invI = [1 / asSxI, 0, 0, 1 / asSyI, 0, 0];
14424
+ const RthetaI = fabric__namespace.util.composeMatrix({
14425
+ angle: childAngleDegI,
14426
+ scaleX: 1,
14427
+ scaleY: 1,
14428
+ translateX: 0,
14429
+ translateY: 0
14430
+ });
14431
+ const MI = fabric__namespace.util.multiplyTransformMatrices(invI, RthetaI);
14432
+ const decI = fabric__namespace.util.qrDecompose(MI);
14433
+ child._set("angle", decI.angle);
14434
+ child._set("scaleX", decI.scaleX);
14435
+ child._set("scaleY", decI.scaleY);
14436
+ child._set("skewX", decI.skewX);
14437
+ child._set("skewY", decI.skewY);
14438
+ } catch {
14439
+ }
14440
+ child.setCoords();
14441
+ child.dirty = true;
14398
14442
  continue;
14399
14443
  }
14400
14444
  if (!(child instanceof fabric__namespace.Textbox)) continue;
@@ -24992,9 +25036,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24992
25036
  }
24993
25037
  return svgString;
24994
25038
  }
24995
- const resolvedPackageVersion = "0.5.388";
25039
+ const resolvedPackageVersion = "0.5.389";
24996
25040
  const PACKAGE_VERSION = resolvedPackageVersion;
24997
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.388";
25041
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.389";
24998
25042
  const roundParityValue = (value) => {
24999
25043
  if (typeof value !== "number") return value;
25000
25044
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25808,7 +25852,7 @@ class PixldocsRenderer {
25808
25852
  await this.waitForCanvasScene(container, cloned, i);
25809
25853
  }
25810
25854
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25811
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BMKSimKF.cjs"));
25855
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BRGM-p11.cjs"));
25812
25856
  const prepared = preparePagesForExport(
25813
25857
  cloned.pages,
25814
25858
  canvasWidth,
@@ -28128,7 +28172,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28128
28172
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28129
28173
  sanitizeSvgTreeForPdf(svgToDraw);
28130
28174
  try {
28131
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BMKSimKF.cjs"));
28175
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BRGM-p11.cjs"));
28132
28176
  try {
28133
28177
  await logTextMeasurementDiagnostic(svgToDraw);
28134
28178
  } catch {
@@ -28525,4 +28569,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28525
28569
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28526
28570
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28527
28571
  exports.warmTemplateFromForm = warmTemplateFromForm;
28528
- //# sourceMappingURL=index-CnSzRkFP.cjs.map
28572
+ //# sourceMappingURL=index-Z4UNgyZW.cjs.map