@pixldocs/canvas-renderer 0.5.399 → 0.5.400

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.
@@ -11523,7 +11523,12 @@ function applyWarpAwareSelectionBorders(selection) {
11523
11523
  if (isLogicalGroupSelection && typeof frozenGroupAngle === "number" && Math.abs(frozenGroupAngle) > 0.5) {
11524
11524
  targetAngle = frozenGroupAngle;
11525
11525
  }
11526
- if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
11526
+ if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && // Canva-style: for a *logical group* the bbox angle is authoritative
11527
+ // from the persisted group.angle (frozenGroupAngle) only. Individual
11528
+ // child rotations must NEVER drift the group's selection bbox angle.
11529
+ // The dominant-angle fallback is reserved for ad-hoc multi-selects
11530
+ // (no logical group), where matching child rotation is desirable.
11531
+ (!isLogicalGroupSelection && (kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length))) {
11527
11532
  targetAngle = dominant.angle;
11528
11533
  }
11529
11534
  if (targetAngle != null) {
@@ -13597,15 +13602,10 @@ const PageCanvas = react.forwardRef(
13597
13602
  if (oid && memberIds.has(oid)) members.push(o);
13598
13603
  }
13599
13604
  if (members.length === 0) return null;
13600
- const TOL = 2;
13601
13605
  const norm = (a) => {
13602
13606
  const n = (a % 360 + 360) % 360;
13603
13607
  return n > 180 ? n - 360 : n;
13604
13608
  };
13605
- const angleDelta = (a, b) => {
13606
- const d = Math.abs(norm(a) - norm(b));
13607
- return Math.min(d, 360 - d);
13608
- };
13609
13609
  const worldPoints = [];
13610
13610
  for (const m of members) {
13611
13611
  (_a2 = m.setCoords) == null ? void 0 : _a2.call(m);
@@ -13616,36 +13616,12 @@ const PageCanvas = react.forwardRef(
13616
13616
  if (p) worldPoints.push({ x: p.x, y: p.y });
13617
13617
  }
13618
13618
  }
13619
- const orientedAreaForAngle = (angle) => {
13620
- if (worldPoints.length === 0) return Number.POSITIVE_INFINITY;
13621
- const r = -angle * Math.PI / 180;
13622
- const c = Math.cos(r), s = Math.sin(r);
13623
- let nX = Infinity, nY = Infinity, xX = -Infinity, xY = -Infinity;
13624
- for (const p of worldPoints) {
13625
- const xr = p.x * c - p.y * s;
13626
- const yr = p.x * s + p.y * c;
13627
- if (xr < nX) nX = xr;
13628
- if (yr < nY) nY = yr;
13629
- if (xr > xX) xX = xr;
13630
- if (yr > xY) xY = yr;
13631
- }
13632
- return Math.max(1, (xX - nX) * (xY - nY));
13633
- };
13634
13619
  let a0;
13635
13620
  const savedGroupAngle = norm(g.angle ?? 0);
13636
13621
  if (Math.abs(savedGroupAngle) > 0.01) {
13637
13622
  a0 = savedGroupAngle;
13638
13623
  } else {
13639
- const buckets = [];
13640
- for (const m of members) {
13641
- const a = norm(m.angle ?? 0);
13642
- const b = buckets.find((x) => angleDelta(x.angle, a) <= TOL);
13643
- if (b) b.count++;
13644
- else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
13645
- }
13646
- for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
13647
- buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
13648
- a0 = buckets[0].angle;
13624
+ a0 = 0;
13649
13625
  }
13650
13626
  const rad = -a0 * Math.PI / 180;
13651
13627
  const cos = Math.cos(rad), sin = Math.sin(rad);
@@ -25159,9 +25135,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25159
25135
  }
25160
25136
  return svgString;
25161
25137
  }
25162
- const resolvedPackageVersion = "0.5.399";
25138
+ const resolvedPackageVersion = "0.5.400";
25163
25139
  const PACKAGE_VERSION = resolvedPackageVersion;
25164
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.399";
25140
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.400";
25165
25141
  const roundParityValue = (value) => {
25166
25142
  if (typeof value !== "number") return value;
25167
25143
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25975,7 +25951,7 @@ class PixldocsRenderer {
25975
25951
  await this.waitForCanvasScene(container, cloned, i);
25976
25952
  }
25977
25953
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25978
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bvm0vPj2.cjs"));
25954
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-EaqO1vVi.cjs"));
25979
25955
  const prepared = preparePagesForExport(
25980
25956
  cloned.pages,
25981
25957
  canvasWidth,
@@ -28295,7 +28271,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28295
28271
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28296
28272
  sanitizeSvgTreeForPdf(svgToDraw);
28297
28273
  try {
28298
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Bvm0vPj2.cjs"));
28274
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-EaqO1vVi.cjs"));
28299
28275
  try {
28300
28276
  await logTextMeasurementDiagnostic(svgToDraw);
28301
28277
  } catch {
@@ -28692,4 +28668,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28692
28668
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28693
28669
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28694
28670
  exports.warmTemplateFromForm = warmTemplateFromForm;
28695
- //# sourceMappingURL=index-BJ-DTm0r.cjs.map
28671
+ //# sourceMappingURL=index-CJQpuR_V.cjs.map