@pixldocs/canvas-renderer 0.5.383 → 0.5.384

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.
@@ -14246,6 +14246,35 @@ const PageCanvas = react.forwardRef(
14246
14246
  const asRect0 = obj.getBoundingRect();
14247
14247
  let didReflowTextChild = false;
14248
14248
  for (const child of obj.getObjects()) {
14249
+ if (child instanceof fabric__namespace.Textbox && !child.__asRotChildSnap) {
14250
+ const ang = ((child.angle ?? 0) % 360 + 360) % 360;
14251
+ const isRot = Math.min(ang, 360 - ang) > 0.5;
14252
+ if (isRot) {
14253
+ try {
14254
+ const wm = child.calcTransformMatrix();
14255
+ const decomp = fabric__namespace.util.qrDecompose(wm);
14256
+ const asMatrix = obj.calcTransformMatrix();
14257
+ const invAS = fabric__namespace.util.invertTransform(asMatrix);
14258
+ const localCenter = fabric__namespace.util.transformPoint(
14259
+ new fabric__namespace.Point(decomp.translateX, decomp.translateY),
14260
+ invAS
14261
+ );
14262
+ child.__asRotChildSnap = {
14263
+ cx0: decomp.translateX,
14264
+ cy0: decomp.translateY,
14265
+ theta0: child.angle ?? 0,
14266
+ w0: child.width ?? 0,
14267
+ h0: child.height ?? 0,
14268
+ localCx: localCenter.x,
14269
+ localCy: localCenter.y
14270
+ };
14271
+ } catch {
14272
+ }
14273
+ }
14274
+ }
14275
+ if (child instanceof fabric__namespace.Textbox && child.__asRotChildSnap) {
14276
+ continue;
14277
+ }
14249
14278
  if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
14250
14279
  const ct = child.__cropData;
14251
14280
  if (!ct) continue;
@@ -14734,6 +14763,7 @@ const PageCanvas = react.forwardRef(
14734
14763
  delete child.__asLiveOrigW;
14735
14764
  delete child.__asLiveOrigH;
14736
14765
  delete child.__asLiveRotSnap;
14766
+ delete child.__asRotChildSnap;
14737
14767
  }
14738
14768
  }
14739
14769
  } catch {
@@ -15653,6 +15683,45 @@ const PageCanvas = react.forwardRef(
15653
15683
  elementUpdate
15654
15684
  });
15655
15685
  }
15686
+ const rotSnap = obj.__asRotChildSnap;
15687
+ if (rotSnap && isActiveSelection && activeObj && obj instanceof fabric__namespace.Textbox) {
15688
+ try {
15689
+ const asFinal = activeObj.calcTransformMatrix();
15690
+ const newWorldCenter = fabric__namespace.util.transformPoint(
15691
+ new fabric__namespace.Point(rotSnap.localCx, rotSnap.localCy),
15692
+ asFinal
15693
+ );
15694
+ const theta = rotSnap.theta0;
15695
+ const w = rotSnap.w0;
15696
+ const h = rotSnap.h0;
15697
+ const rad = theta * Math.PI / 180;
15698
+ const cos = Math.cos(rad);
15699
+ const sin = Math.sin(rad);
15700
+ const ox = newWorldCenter.x - (cos * w / 2 - sin * h / 2);
15701
+ const oy = newWorldCenter.y - (sin * w / 2 + cos * h / 2);
15702
+ const rotStorePos = absoluteToStorePosition(ox, oy, objId, pageChildrenForSave);
15703
+ elementUpdate.left = rotStorePos.left;
15704
+ elementUpdate.top = rotStorePos.top;
15705
+ elementUpdate.width = w;
15706
+ elementUpdate.height = h;
15707
+ elementUpdate.angle = theta;
15708
+ elementUpdate.scaleX = 1;
15709
+ elementUpdate.scaleY = 1;
15710
+ elementUpdate.skewX = 0;
15711
+ elementUpdate.skewY = 0;
15712
+ elementUpdate.transformMatrix = fabric__namespace.util.composeMatrix({
15713
+ translateX: newWorldCenter.x,
15714
+ translateY: newWorldCenter.y,
15715
+ angle: theta,
15716
+ scaleX: 1,
15717
+ scaleY: 1,
15718
+ skewX: 0,
15719
+ skewY: 0
15720
+ });
15721
+ } catch {
15722
+ }
15723
+ delete obj.__asRotChildSnap;
15724
+ }
15656
15725
  updateElement(objId, elementUpdate, { recordHistory: false, skipLayoutRecalc: true });
15657
15726
  obj.setCoords();
15658
15727
  }
@@ -24834,9 +24903,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24834
24903
  }
24835
24904
  return svgString;
24836
24905
  }
24837
- const resolvedPackageVersion = "0.5.383";
24906
+ const resolvedPackageVersion = "0.5.384";
24838
24907
  const PACKAGE_VERSION = resolvedPackageVersion;
24839
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.383";
24908
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.384";
24840
24909
  const roundParityValue = (value) => {
24841
24910
  if (typeof value !== "number") return value;
24842
24911
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25650,7 +25719,7 @@ class PixldocsRenderer {
25650
25719
  await this.waitForCanvasScene(container, cloned, i);
25651
25720
  }
25652
25721
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25653
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DxRLDNdM.cjs"));
25722
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CwGVLCXD.cjs"));
25654
25723
  const prepared = preparePagesForExport(
25655
25724
  cloned.pages,
25656
25725
  canvasWidth,
@@ -27970,7 +28039,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27970
28039
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27971
28040
  sanitizeSvgTreeForPdf(svgToDraw);
27972
28041
  try {
27973
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DxRLDNdM.cjs"));
28042
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CwGVLCXD.cjs"));
27974
28043
  try {
27975
28044
  await logTextMeasurementDiagnostic(svgToDraw);
27976
28045
  } catch {
@@ -28367,4 +28436,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28367
28436
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28368
28437
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28369
28438
  exports.warmTemplateFromForm = warmTemplateFromForm;
28370
- //# sourceMappingURL=index-BOr3yt00.cjs.map
28439
+ //# sourceMappingURL=index-CIEk2Lju.cjs.map