@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.
@@ -11505,7 +11505,12 @@ function applyWarpAwareSelectionBorders(selection) {
11505
11505
  if (isLogicalGroupSelection && typeof frozenGroupAngle === "number" && Math.abs(frozenGroupAngle) > 0.5) {
11506
11506
  targetAngle = frozenGroupAngle;
11507
11507
  }
11508
- if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
11508
+ if (targetAngle == null && dominant && Math.abs(dominant.angle) > 0.5 && // Canva-style: for a *logical group* the bbox angle is authoritative
11509
+ // from the persisted group.angle (frozenGroupAngle) only. Individual
11510
+ // child rotations must NEVER drift the group's selection bbox angle.
11511
+ // The dominant-angle fallback is reserved for ad-hoc multi-selects
11512
+ // (no logical group), where matching child rotation is desirable.
11513
+ (!isLogicalGroupSelection && (kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length))) {
11509
11514
  targetAngle = dominant.angle;
11510
11515
  }
11511
11516
  if (targetAngle != null) {
@@ -13579,15 +13584,10 @@ const PageCanvas = forwardRef(
13579
13584
  if (oid && memberIds.has(oid)) members.push(o);
13580
13585
  }
13581
13586
  if (members.length === 0) return null;
13582
- const TOL = 2;
13583
13587
  const norm = (a) => {
13584
13588
  const n = (a % 360 + 360) % 360;
13585
13589
  return n > 180 ? n - 360 : n;
13586
13590
  };
13587
- const angleDelta = (a, b) => {
13588
- const d = Math.abs(norm(a) - norm(b));
13589
- return Math.min(d, 360 - d);
13590
- };
13591
13591
  const worldPoints = [];
13592
13592
  for (const m of members) {
13593
13593
  (_a2 = m.setCoords) == null ? void 0 : _a2.call(m);
@@ -13598,36 +13598,12 @@ const PageCanvas = forwardRef(
13598
13598
  if (p) worldPoints.push({ x: p.x, y: p.y });
13599
13599
  }
13600
13600
  }
13601
- const orientedAreaForAngle = (angle) => {
13602
- if (worldPoints.length === 0) return Number.POSITIVE_INFINITY;
13603
- const r = -angle * Math.PI / 180;
13604
- const c = Math.cos(r), s = Math.sin(r);
13605
- let nX = Infinity, nY = Infinity, xX = -Infinity, xY = -Infinity;
13606
- for (const p of worldPoints) {
13607
- const xr = p.x * c - p.y * s;
13608
- const yr = p.x * s + p.y * c;
13609
- if (xr < nX) nX = xr;
13610
- if (yr < nY) nY = yr;
13611
- if (xr > xX) xX = xr;
13612
- if (yr > xY) xY = yr;
13613
- }
13614
- return Math.max(1, (xX - nX) * (xY - nY));
13615
- };
13616
13601
  let a0;
13617
13602
  const savedGroupAngle = norm(g.angle ?? 0);
13618
13603
  if (Math.abs(savedGroupAngle) > 0.01) {
13619
13604
  a0 = savedGroupAngle;
13620
13605
  } else {
13621
- const buckets = [];
13622
- for (const m of members) {
13623
- const a = norm(m.angle ?? 0);
13624
- const b = buckets.find((x) => angleDelta(x.angle, a) <= TOL);
13625
- if (b) b.count++;
13626
- else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
13627
- }
13628
- for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
13629
- buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
13630
- a0 = buckets[0].angle;
13606
+ a0 = 0;
13631
13607
  }
13632
13608
  const rad = -a0 * Math.PI / 180;
13633
13609
  const cos = Math.cos(rad), sin = Math.sin(rad);
@@ -25141,9 +25117,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
25141
25117
  }
25142
25118
  return svgString;
25143
25119
  }
25144
- const resolvedPackageVersion = "0.5.399";
25120
+ const resolvedPackageVersion = "0.5.400";
25145
25121
  const PACKAGE_VERSION = resolvedPackageVersion;
25146
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.399";
25122
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.400";
25147
25123
  const roundParityValue = (value) => {
25148
25124
  if (typeof value !== "number") return value;
25149
25125
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25957,7 +25933,7 @@ class PixldocsRenderer {
25957
25933
  await this.waitForCanvasScene(container, cloned, i);
25958
25934
  }
25959
25935
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25960
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CyA0vb5f.js");
25936
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DB5Ygq25.js");
25961
25937
  const prepared = preparePagesForExport(
25962
25938
  cloned.pages,
25963
25939
  canvasWidth,
@@ -28277,7 +28253,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
28277
28253
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
28278
28254
  sanitizeSvgTreeForPdf(svgToDraw);
28279
28255
  try {
28280
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CyA0vb5f.js");
28256
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DB5Ygq25.js");
28281
28257
  try {
28282
28258
  await logTextMeasurementDiagnostic(svgToDraw);
28283
28259
  } catch {
@@ -28677,4 +28653,4 @@ export {
28677
28653
  buildTeaserBlurFlatKeys as y,
28678
28654
  collectFontDescriptorsFromConfig as z
28679
28655
  };
28680
- //# sourceMappingURL=index-yLA9pqpr.js.map
28656
+ //# sourceMappingURL=index-B2tApyM3.js.map