@pixldocs/canvas-renderer 0.5.311 → 0.5.312

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.
@@ -11169,25 +11169,41 @@ function applyWarpAwareSelectionBorders(selection) {
11169
11169
  selection.hasBorders = true;
11170
11170
  selection.hasControls = true;
11171
11171
  try {
11172
- const kids = selection.getObjects();
11173
- let allSameNonZero = kids.length > 0;
11174
- const first = ((((_a2 = kids[0]) == null ? void 0 : _a2.angle) ?? 0) % 360 + 360) % 360;
11175
- if (Math.abs(first) < 0.5 || Math.abs(first - 360) < 0.5) allSameNonZero = false;
11176
- if (allSameNonZero) {
11177
- for (const k of kids) {
11178
- const a = ((k.angle ?? 0) % 360 + 360) % 360;
11179
- if (Math.abs(a - first) > 0.5) {
11180
- allSameNonZero = false;
11181
- break;
11172
+ if (selection.__pixldocsAlignedAngle == null) {
11173
+ const kids = selection.getObjects();
11174
+ if (kids.length >= 1) {
11175
+ const norm = (a) => {
11176
+ const n = (a % 360 + 360) % 360;
11177
+ return n > 180 ? n - 360 : n;
11178
+ };
11179
+ const first = norm(((_a2 = kids[0]) == null ? void 0 : _a2.angle) ?? 0);
11180
+ let allSame = Math.abs(first) > 0.5;
11181
+ if (allSame) {
11182
+ for (const k of kids) {
11183
+ if (Math.abs(norm(k.angle ?? 0) - first) > 0.5) {
11184
+ allSame = false;
11185
+ break;
11186
+ }
11187
+ }
11188
+ }
11189
+ if (allSame) {
11190
+ const rad = -first * Math.PI / 180;
11191
+ const cos = Math.cos(rad), sin = Math.sin(rad);
11192
+ for (const k of kids) {
11193
+ const x = k.left ?? 0, y = k.top ?? 0;
11194
+ k.set({
11195
+ left: x * cos - y * sin,
11196
+ top: x * sin + y * cos,
11197
+ angle: 0
11198
+ });
11199
+ k.setCoords();
11200
+ }
11201
+ selection.set({ angle: first });
11202
+ selection.setCoords();
11203
+ selection.__pixldocsAlignedAngle = first;
11182
11204
  }
11183
11205
  }
11184
11206
  }
11185
- selection.setControlsVisibility({
11186
- ml: !allSameNonZero,
11187
- mr: !allSameNonZero,
11188
- mt: !allSameNonZero,
11189
- mb: !allSameNonZero
11190
- });
11191
11207
  } catch {
11192
11208
  }
11193
11209
  }
@@ -24233,9 +24249,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24233
24249
  }
24234
24250
  return svgString;
24235
24251
  }
24236
- const resolvedPackageVersion = "0.5.311";
24252
+ const resolvedPackageVersion = "0.5.312";
24237
24253
  const PACKAGE_VERSION = resolvedPackageVersion;
24238
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.311";
24254
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.312";
24239
24255
  const roundParityValue = (value) => {
24240
24256
  if (typeof value !== "number") return value;
24241
24257
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25049,7 +25065,7 @@ class PixldocsRenderer {
25049
25065
  await this.waitForCanvasScene(container, cloned, i);
25050
25066
  }
25051
25067
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25052
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DouKBaoG.js");
25068
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-D5wEVDWm.js");
25053
25069
  const prepared = preparePagesForExport(
25054
25070
  cloned.pages,
25055
25071
  canvasWidth,
@@ -27369,7 +27385,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27369
27385
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27370
27386
  sanitizeSvgTreeForPdf(svgToDraw);
27371
27387
  try {
27372
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DouKBaoG.js");
27388
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-D5wEVDWm.js");
27373
27389
  try {
27374
27390
  await logTextMeasurementDiagnostic(svgToDraw);
27375
27391
  } catch {
@@ -27769,4 +27785,4 @@ export {
27769
27785
  buildTeaserBlurFlatKeys as y,
27770
27786
  collectFontDescriptorsFromConfig as z
27771
27787
  };
27772
- //# sourceMappingURL=index-BGRSqiXc.js.map
27788
+ //# sourceMappingURL=index-P103UWW3.js.map