@pixldocs/canvas-renderer 0.5.389 → 0.5.390

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.
@@ -13540,13 +13540,19 @@ const PageCanvas = react.forwardRef(
13540
13540
  if (oid && memberIds.has(oid)) members.push(o);
13541
13541
  }
13542
13542
  if (members.length === 0) return null;
13543
- const a0 = ((members[0].angle ?? 0) % 360 + 360) % 360;
13544
13543
  const TOL = 0.5;
13544
+ const buckets = [];
13545
13545
  for (const m of members) {
13546
13546
  const a = ((m.angle ?? 0) % 360 + 360) % 360;
13547
- const diff = Math.min(Math.abs(a - a0), 360 - Math.abs(a - a0));
13548
- if (diff > TOL) return null;
13547
+ const b = buckets.find((x) => {
13548
+ const d = Math.min(Math.abs(x.angle - a), 360 - Math.abs(x.angle - a));
13549
+ return d <= TOL;
13550
+ });
13551
+ if (b) b.count++;
13552
+ else buckets.push({ angle: a, count: 1 });
13549
13553
  }
13554
+ buckets.sort((a, b) => b.count - a.count);
13555
+ const a0 = buckets[0].angle;
13550
13556
  const rad = -a0 * Math.PI / 180;
13551
13557
  const cos = Math.cos(rad), sin = Math.sin(rad);
13552
13558
  let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
@@ -25036,9 +25042,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25036
25042
  }
25037
25043
  return svgString;
25038
25044
  }
25039
- const resolvedPackageVersion = "0.5.389";
25045
+ const resolvedPackageVersion = "0.5.390";
25040
25046
  const PACKAGE_VERSION = resolvedPackageVersion;
25041
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.389";
25047
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.390";
25042
25048
  const roundParityValue = (value) => {
25043
25049
  if (typeof value !== "number") return value;
25044
25050
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25852,7 +25858,7 @@ class PixldocsRenderer {
25852
25858
  await this.waitForCanvasScene(container, cloned, i);
25853
25859
  }
25854
25860
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25855
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BRGM-p11.cjs"));
25861
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-3tLyCSst.cjs"));
25856
25862
  const prepared = preparePagesForExport(
25857
25863
  cloned.pages,
25858
25864
  canvasWidth,
@@ -28172,7 +28178,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28172
28178
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28173
28179
  sanitizeSvgTreeForPdf(svgToDraw);
28174
28180
  try {
28175
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BRGM-p11.cjs"));
28181
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-3tLyCSst.cjs"));
28176
28182
  try {
28177
28183
  await logTextMeasurementDiagnostic(svgToDraw);
28178
28184
  } catch {
@@ -28569,4 +28575,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28569
28575
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28570
28576
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28571
28577
  exports.warmTemplateFromForm = warmTemplateFromForm;
28572
- //# sourceMappingURL=index-Z4UNgyZW.cjs.map
28578
+ //# sourceMappingURL=index-BAbK6GX5.cjs.map