@pixldocs/canvas-renderer 0.5.390 → 0.5.391

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.
@@ -11455,12 +11455,18 @@ function applyWarpAwareSelectionBorders(selection) {
11455
11455
  k.calcOwnMatrix()
11456
11456
  ));
11457
11457
  const worldAngles = worldMatrices.map((m) => norm(fabric.util.qrDecompose(m).angle ?? 0));
11458
- const first = worldAngles[0] ?? 0;
11459
11458
  const ALL_SAME_TOL_DEG = 2;
11460
- const allSame = Math.abs(first) > 0.5 && worldAngles.every((a) => angleDelta(a, first) <= ALL_SAME_TOL_DEG);
11459
+ const buckets = [];
11460
+ for (const a of worldAngles) {
11461
+ const b = buckets.find((x) => angleDelta(x.angle, a) <= ALL_SAME_TOL_DEG);
11462
+ if (b) b.count++;
11463
+ else buckets.push({ angle: a, count: 1 });
11464
+ }
11465
+ buckets.sort((a, b) => b.count - a.count);
11466
+ const dominant = buckets[0];
11461
11467
  let targetAngle = null;
11462
- if (allSame) {
11463
- targetAngle = first;
11468
+ if (dominant && Math.abs(dominant.angle) > 0.5 && (kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
11469
+ targetAngle = dominant.angle;
11464
11470
  }
11465
11471
  if (targetAngle != null) {
11466
11472
  const restoreKidsFromWorld = () => {
@@ -25024,9 +25030,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25024
25030
  }
25025
25031
  return svgString;
25026
25032
  }
25027
- const resolvedPackageVersion = "0.5.390";
25033
+ const resolvedPackageVersion = "0.5.391";
25028
25034
  const PACKAGE_VERSION = resolvedPackageVersion;
25029
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.390";
25035
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.391";
25030
25036
  const roundParityValue = (value) => {
25031
25037
  if (typeof value !== "number") return value;
25032
25038
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25840,7 +25846,7 @@ class PixldocsRenderer {
25840
25846
  await this.waitForCanvasScene(container, cloned, i);
25841
25847
  }
25842
25848
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25843
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-p4K2EISX.js");
25849
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C8_CSDHY.js");
25844
25850
  const prepared = preparePagesForExport(
25845
25851
  cloned.pages,
25846
25852
  canvasWidth,
@@ -28160,7 +28166,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28160
28166
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28161
28167
  sanitizeSvgTreeForPdf(svgToDraw);
28162
28168
  try {
28163
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-p4K2EISX.js");
28169
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C8_CSDHY.js");
28164
28170
  try {
28165
28171
  await logTextMeasurementDiagnostic(svgToDraw);
28166
28172
  } catch {
@@ -28560,4 +28566,4 @@ export {
28560
28566
  buildTeaserBlurFlatKeys as y,
28561
28567
  collectFontDescriptorsFromConfig as z
28562
28568
  };
28563
- //# sourceMappingURL=index-ByJXwd5Y.js.map
28569
+ //# sourceMappingURL=index-Cx-Z8HWW.js.map