@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.
@@ -11473,12 +11473,18 @@ function applyWarpAwareSelectionBorders(selection) {
11473
11473
  k.calcOwnMatrix()
11474
11474
  ));
11475
11475
  const worldAngles = worldMatrices.map((m) => norm(fabric__namespace.util.qrDecompose(m).angle ?? 0));
11476
- const first = worldAngles[0] ?? 0;
11477
11476
  const ALL_SAME_TOL_DEG = 2;
11478
- const allSame = Math.abs(first) > 0.5 && worldAngles.every((a) => angleDelta(a, first) <= ALL_SAME_TOL_DEG);
11477
+ const buckets = [];
11478
+ for (const a of worldAngles) {
11479
+ const b = buckets.find((x) => angleDelta(x.angle, a) <= ALL_SAME_TOL_DEG);
11480
+ if (b) b.count++;
11481
+ else buckets.push({ angle: a, count: 1 });
11482
+ }
11483
+ buckets.sort((a, b) => b.count - a.count);
11484
+ const dominant = buckets[0];
11479
11485
  let targetAngle = null;
11480
- if (allSame) {
11481
- targetAngle = first;
11486
+ if (dominant && Math.abs(dominant.angle) > 0.5 && (kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
11487
+ targetAngle = dominant.angle;
11482
11488
  }
11483
11489
  if (targetAngle != null) {
11484
11490
  const restoreKidsFromWorld = () => {
@@ -25042,9 +25048,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25042
25048
  }
25043
25049
  return svgString;
25044
25050
  }
25045
- const resolvedPackageVersion = "0.5.390";
25051
+ const resolvedPackageVersion = "0.5.391";
25046
25052
  const PACKAGE_VERSION = resolvedPackageVersion;
25047
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.390";
25053
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.391";
25048
25054
  const roundParityValue = (value) => {
25049
25055
  if (typeof value !== "number") return value;
25050
25056
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25858,7 +25864,7 @@ class PixldocsRenderer {
25858
25864
  await this.waitForCanvasScene(container, cloned, i);
25859
25865
  }
25860
25866
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25861
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-3tLyCSst.cjs"));
25867
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-B8BF2GBZ.cjs"));
25862
25868
  const prepared = preparePagesForExport(
25863
25869
  cloned.pages,
25864
25870
  canvasWidth,
@@ -28178,7 +28184,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28178
28184
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28179
28185
  sanitizeSvgTreeForPdf(svgToDraw);
28180
28186
  try {
28181
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-3tLyCSst.cjs"));
28187
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-B8BF2GBZ.cjs"));
28182
28188
  try {
28183
28189
  await logTextMeasurementDiagnostic(svgToDraw);
28184
28190
  } catch {
@@ -28575,4 +28581,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28575
28581
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28576
28582
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28577
28583
  exports.warmTemplateFromForm = warmTemplateFromForm;
28578
- //# sourceMappingURL=index-BAbK6GX5.cjs.map
28584
+ //# sourceMappingURL=index-C5CC51On.cjs.map