@pixldocs/canvas-renderer 0.5.316 → 0.5.318

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.
@@ -13588,17 +13588,21 @@ const PageCanvas = react.forwardRef(
13588
13588
  fabricCanvas.on("selection:cleared", () => {
13589
13589
  });
13590
13590
  fabricCanvas.on("object:scaling", (e) => {
13591
- var _a2, _b2, _c, _d, _e, _f, _g;
13591
+ var _a2, _b2, _c, _d, _e, _f, _g, _h;
13592
13592
  if (!isActiveRef.current) return;
13593
13593
  const t = e.target;
13594
13594
  if (t) lastResizeScaleTargetRef.current = t;
13595
13595
  try {
13596
- if (t instanceof fabric__namespace.ActiveSelection && t.__pixldocsMixedRotation) {
13597
- const corner2 = (_a2 = e.transform) == null ? void 0 : _a2.corner;
13598
- if (corner2 === "ml" || corner2 === "mr") {
13599
- t.scaleY = t.scaleX;
13600
- } else if (corner2 === "mt" || corner2 === "mb") {
13601
- t.scaleX = t.scaleY;
13596
+ const isNativeGroup = t instanceof fabric__namespace.Group && !(t instanceof fabric__namespace.ActiveSelection) && !t.__docuforgeSectionGroup && !t.__cropGroup && !((_a2 = t._ct) == null ? void 0 : _a2.isCropGroup) && !t.__smartController;
13597
+ if (t instanceof fabric__namespace.ActiveSelection || isNativeGroup) {
13598
+ const isRotated = !!t.__pixldocsMixedRotation || Math.abs(((t.angle ?? 0) % 360 + 360) % 360) > 0.5;
13599
+ if (isRotated) {
13600
+ const corner2 = (_b2 = e.transform) == null ? void 0 : _b2.corner;
13601
+ if (corner2 === "ml" || corner2 === "mr") {
13602
+ t.scaleY = t.scaleX;
13603
+ } else if (corner2 === "mt" || corner2 === "mb") {
13604
+ t.scaleX = t.scaleY;
13605
+ }
13602
13606
  }
13603
13607
  }
13604
13608
  } catch {
@@ -13766,23 +13770,24 @@ const PageCanvas = react.forwardRef(
13766
13770
  time: Math.round(performance.now()),
13767
13771
  corner,
13768
13772
  groupSelectionId: obj.__pixldocsGroupSelection,
13769
- currentTransformAction: (_b2 = fabricCanvas._currentTransform) == null ? void 0 : _b2.action,
13773
+ currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
13770
13774
  selection: summarizeFabricObjectForResizeDebug(obj),
13771
13775
  textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
13772
13776
  };
13773
13777
  }
13774
13778
  }
13775
- if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
13779
+ const _asRotatedForReflow = obj instanceof fabric__namespace.ActiveSelection && (!!obj.__pixldocsMixedRotation || Math.abs(((obj.angle ?? 0) % 360 + 360) % 360) > 0.5);
13780
+ if (obj instanceof fabric__namespace.ActiveSelection && !_asRotatedForReflow && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
13776
13781
  const isXSide = corner === "ml" || corner === "mr";
13777
13782
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
13778
13783
  if (sAxis > 1e-3) {
13779
- if (isXSide && ((_c = groupShiftReflowSnapshotRef.current) == null ? void 0 : _c.selection) !== obj) {
13784
+ if (isXSide && ((_d = groupShiftReflowSnapshotRef.current) == null ? void 0 : _d.selection) !== obj) {
13780
13785
  groupShiftReflowSnapshotRef.current = null;
13781
13786
  const logicalGroupId = obj.__pixldocsGroupSelection;
13782
13787
  if (logicalGroupId) {
13783
13788
  try {
13784
13789
  const state = useEditorStore.getState();
13785
- const pageChildren2 = ((_d = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _d.children) ?? [];
13790
+ const pageChildren2 = ((_e = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
13786
13791
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
13787
13792
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
13788
13793
  const entries = obj.getObjects().map((c) => ({
@@ -13812,7 +13817,7 @@ const PageCanvas = react.forwardRef(
13812
13817
  const asRect0 = obj.getBoundingRect();
13813
13818
  let didReflowTextChild = false;
13814
13819
  for (const child of obj.getObjects()) {
13815
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_e = child._ct) == null ? void 0 : _e.isCropGroup))) {
13820
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
13816
13821
  const ct = child.__cropData;
13817
13822
  if (!ct) continue;
13818
13823
  if (isXSide) {
@@ -13917,7 +13922,7 @@ const PageCanvas = react.forwardRef(
13917
13922
  didReflowTextChild = true;
13918
13923
  }
13919
13924
  }
13920
- if (isXSide && ((_f = groupShiftReflowSnapshotRef.current) == null ? void 0 : _f.selection) === obj) {
13925
+ if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
13921
13926
  const snap = groupShiftReflowSnapshotRef.current;
13922
13927
  const anchorEntry = snap.children[0];
13923
13928
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14073,7 +14078,7 @@ const PageCanvas = react.forwardRef(
14073
14078
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14074
14079
  if (drilledGroupIdRef.current) {
14075
14080
  try {
14076
- (_g = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _g.call(fabricCanvas);
14081
+ (_h = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _h.call(fabricCanvas);
14077
14082
  } catch {
14078
14083
  }
14079
14084
  }
@@ -24303,9 +24308,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24303
24308
  }
24304
24309
  return svgString;
24305
24310
  }
24306
- const resolvedPackageVersion = "0.5.316";
24311
+ const resolvedPackageVersion = "0.5.318";
24307
24312
  const PACKAGE_VERSION = resolvedPackageVersion;
24308
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.316";
24313
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.318";
24309
24314
  const roundParityValue = (value) => {
24310
24315
  if (typeof value !== "number") return value;
24311
24316
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25119,7 +25124,7 @@ class PixldocsRenderer {
25119
25124
  await this.waitForCanvasScene(container, cloned, i);
25120
25125
  }
25121
25126
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25122
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CFD-x_MA.cjs"));
25127
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DM_wkrZm.cjs"));
25123
25128
  const prepared = preparePagesForExport(
25124
25129
  cloned.pages,
25125
25130
  canvasWidth,
@@ -27439,7 +27444,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27439
27444
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27440
27445
  sanitizeSvgTreeForPdf(svgToDraw);
27441
27446
  try {
27442
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CFD-x_MA.cjs"));
27447
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DM_wkrZm.cjs"));
27443
27448
  try {
27444
27449
  await logTextMeasurementDiagnostic(svgToDraw);
27445
27450
  } catch {
@@ -27836,4 +27841,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27836
27841
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27837
27842
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27838
27843
  exports.warmTemplateFromForm = warmTemplateFromForm;
27839
- //# sourceMappingURL=index-CnPI9yBL.cjs.map
27844
+ //# sourceMappingURL=index-CjYAXB7l.cjs.map