@pixldocs/canvas-renderer 0.5.318 → 0.5.320

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.
@@ -11204,19 +11204,9 @@ function applyWarpAwareSelectionBorders(selection) {
11204
11204
  const first = worldAngles[0] ?? 0;
11205
11205
  const ALL_SAME_TOL_DEG = 2;
11206
11206
  const allSame = Math.abs(first) > 0.5 && worldAngles.every((a) => angleDelta(a, first) <= ALL_SAME_TOL_DEG);
11207
- const anyRotated = worldAngles.some((a) => Math.abs(a) > 0.5);
11208
11207
  let targetAngle = null;
11209
11208
  if (allSame) {
11210
11209
  targetAngle = first;
11211
- } else if (anyRotated) {
11212
- const rad = (d) => d * Math.PI / 180;
11213
- const deg = (r) => r * 180 / Math.PI;
11214
- let sx = 0, sy = 0;
11215
- for (const a of worldAngles) {
11216
- sx += Math.cos(rad(a));
11217
- sy += Math.sin(rad(a));
11218
- }
11219
- targetAngle = norm(deg(Math.atan2(sy, sx)));
11220
11210
  }
11221
11211
  if (targetAngle != null) {
11222
11212
  const restoreKidsFromWorld = () => {
@@ -11243,7 +11233,6 @@ function applyWarpAwareSelectionBorders(selection) {
11243
11233
  selection.setCoords();
11244
11234
  selection.dirty = true;
11245
11235
  selection.__pixldocsAlignedAngle = targetAngle;
11246
- if (!allSame) selection.__pixldocsMixedRotation = true;
11247
11236
  }
11248
11237
  }
11249
11238
  }
@@ -13588,25 +13577,10 @@ const PageCanvas = react.forwardRef(
13588
13577
  fabricCanvas.on("selection:cleared", () => {
13589
13578
  });
13590
13579
  fabricCanvas.on("object:scaling", (e) => {
13591
- var _a2, _b2, _c, _d, _e, _f, _g, _h;
13580
+ var _a2, _b2, _c, _d, _e, _f;
13592
13581
  if (!isActiveRef.current) return;
13593
13582
  const t = e.target;
13594
13583
  if (t) lastResizeScaleTargetRef.current = t;
13595
- try {
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
- }
13606
- }
13607
- }
13608
- } catch {
13609
- }
13610
13584
  prepareGroupSelectionTransformStart(t);
13611
13585
  markTransforming(t);
13612
13586
  didTransformRef.current = true;
@@ -13770,24 +13744,23 @@ const PageCanvas = react.forwardRef(
13770
13744
  time: Math.round(performance.now()),
13771
13745
  corner,
13772
13746
  groupSelectionId: obj.__pixldocsGroupSelection,
13773
- currentTransformAction: (_c = fabricCanvas._currentTransform) == null ? void 0 : _c.action,
13747
+ currentTransformAction: (_a2 = fabricCanvas._currentTransform) == null ? void 0 : _a2.action,
13774
13748
  selection: summarizeFabricObjectForResizeDebug(obj),
13775
13749
  textChildren: obj.getObjects().filter((child) => child instanceof fabric__namespace.Textbox).map((child) => summarizeFabricObjectForResizeDebug(child))
13776
13750
  };
13777
13751
  }
13778
13752
  }
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")) {
13753
+ if (obj instanceof fabric__namespace.ActiveSelection && (corner === "ml" || corner === "mr" || corner === "mt" || corner === "mb")) {
13781
13754
  const isXSide = corner === "ml" || corner === "mr";
13782
13755
  const sAxis = isXSide ? Math.abs(obj.scaleX ?? 1) : Math.abs(obj.scaleY ?? 1);
13783
13756
  if (sAxis > 1e-3) {
13784
- if (isXSide && ((_d = groupShiftReflowSnapshotRef.current) == null ? void 0 : _d.selection) !== obj) {
13757
+ if (isXSide && ((_b2 = groupShiftReflowSnapshotRef.current) == null ? void 0 : _b2.selection) !== obj) {
13785
13758
  groupShiftReflowSnapshotRef.current = null;
13786
13759
  const logicalGroupId = obj.__pixldocsGroupSelection;
13787
13760
  if (logicalGroupId) {
13788
13761
  try {
13789
13762
  const state = useEditorStore.getState();
13790
- const pageChildren2 = ((_e = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _e.children) ?? [];
13763
+ const pageChildren2 = ((_c = state.canvas.pages.find((p) => p.id === pageId)) == null ? void 0 : _c.children) ?? [];
13791
13764
  const groupNode = findNodeById(pageChildren2, logicalGroupId);
13792
13765
  if (groupNode && isGroup(groupNode) && !isStackLayoutMode(groupNode.layoutMode)) {
13793
13766
  const entries = obj.getObjects().map((c) => ({
@@ -13817,7 +13790,7 @@ const PageCanvas = react.forwardRef(
13817
13790
  const asRect0 = obj.getBoundingRect();
13818
13791
  let didReflowTextChild = false;
13819
13792
  for (const child of obj.getObjects()) {
13820
- if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_f = child._ct) == null ? void 0 : _f.isCropGroup))) {
13793
+ if (child instanceof fabric__namespace.Group && (child.__cropGroup || ((_d = child._ct) == null ? void 0 : _d.isCropGroup))) {
13821
13794
  const ct = child.__cropData;
13822
13795
  if (!ct) continue;
13823
13796
  if (isXSide) {
@@ -13922,7 +13895,7 @@ const PageCanvas = react.forwardRef(
13922
13895
  didReflowTextChild = true;
13923
13896
  }
13924
13897
  }
13925
- if (isXSide && ((_g = groupShiftReflowSnapshotRef.current) == null ? void 0 : _g.selection) === obj) {
13898
+ if (isXSide && ((_e = groupShiftReflowSnapshotRef.current) == null ? void 0 : _e.selection) === obj) {
13926
13899
  const snap = groupShiftReflowSnapshotRef.current;
13927
13900
  const anchorEntry = snap.children[0];
13928
13901
  const anchorTopLive = anchorEntry.obj.top ?? 0;
@@ -14078,7 +14051,7 @@ const PageCanvas = react.forwardRef(
14078
14051
  setGuides(gridGuidesForScale.length ? [...scaleGuides, ...gridGuidesForScale] : scaleGuides);
14079
14052
  if (drilledGroupIdRef.current) {
14080
14053
  try {
14081
- (_h = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _h.call(fabricCanvas);
14054
+ (_f = fabricCanvas.__updateDrilledGroupOutline) == null ? void 0 : _f.call(fabricCanvas);
14082
14055
  } catch {
14083
14056
  }
14084
14057
  }
@@ -24308,9 +24281,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24308
24281
  }
24309
24282
  return svgString;
24310
24283
  }
24311
- const resolvedPackageVersion = "0.5.318";
24284
+ const resolvedPackageVersion = "0.5.320";
24312
24285
  const PACKAGE_VERSION = resolvedPackageVersion;
24313
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.318";
24286
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.320";
24314
24287
  const roundParityValue = (value) => {
24315
24288
  if (typeof value !== "number") return value;
24316
24289
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25124,7 +25097,7 @@ class PixldocsRenderer {
25124
25097
  await this.waitForCanvasScene(container, cloned, i);
25125
25098
  }
25126
25099
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25127
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DM_wkrZm.cjs"));
25100
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BFpf44ad.cjs"));
25128
25101
  const prepared = preparePagesForExport(
25129
25102
  cloned.pages,
25130
25103
  canvasWidth,
@@ -27444,7 +27417,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27444
27417
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27445
27418
  sanitizeSvgTreeForPdf(svgToDraw);
27446
27419
  try {
27447
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DM_wkrZm.cjs"));
27420
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BFpf44ad.cjs"));
27448
27421
  try {
27449
27422
  await logTextMeasurementDiagnostic(svgToDraw);
27450
27423
  } catch {
@@ -27841,4 +27814,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
27841
27814
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
27842
27815
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
27843
27816
  exports.warmTemplateFromForm = warmTemplateFromForm;
27844
- //# sourceMappingURL=index-CjYAXB7l.cjs.map
27817
+ //# sourceMappingURL=index-wHNXUueq.cjs.map