@pixldocs/canvas-renderer 0.5.361 → 0.5.363

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.
@@ -15196,22 +15196,8 @@ const PageCanvas = forwardRef(
15196
15196
  finalScaleX = 1;
15197
15197
  finalScaleY = 1;
15198
15198
  try {
15199
- const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
15200
- const cos = Math.cos(angleRad);
15201
- const sin = Math.sin(angleRad);
15202
- const hw = finalWidth / 2;
15203
- const hh = finalHeight / 2;
15204
- const corners = [
15205
- { x: -hw, y: -hh },
15206
- { x: hw, y: -hh },
15207
- { x: hw, y: hh },
15208
- { x: -hw, y: hh }
15209
- ].map((p) => ({
15210
- x: decomposed.translateX + p.x * cos - p.y * sin,
15211
- y: decomposed.translateY + p.x * sin + p.y * cos
15212
- }));
15213
- absoluteLeft = Math.min(...corners.map((p) => p.x));
15214
- absoluteTop = Math.min(...corners.map((p) => p.y));
15199
+ absoluteLeft = (decomposed.translateX ?? absoluteLeft) - finalWidth / 2;
15200
+ absoluteTop = (decomposed.translateY ?? absoluteTop) - finalHeight / 2;
15215
15201
  } catch {
15216
15202
  }
15217
15203
  finalAbsoluteMatrix = fabric.util.composeMatrix({
@@ -15320,22 +15306,13 @@ const PageCanvas = forwardRef(
15320
15306
  } catch {
15321
15307
  }
15322
15308
  try {
15323
- const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
15324
- const cos = Math.cos(angleRad);
15325
- const sin = Math.sin(angleRad);
15326
- const hw = finalWidth / 2;
15327
- const hh = finalHeight / 2;
15328
- const corners = [
15329
- { x: -hw, y: -hh },
15330
- { x: hw, y: -hh },
15331
- { x: hw, y: hh },
15332
- { x: -hw, y: hh }
15333
- ].map((p) => ({
15334
- x: decomposed.translateX + p.x * cos - p.y * sin,
15335
- y: decomposed.translateY + p.x * sin + p.y * cos
15336
- }));
15337
- absoluteLeft = Math.min(...corners.map((p) => p.x));
15338
- absoluteTop = Math.min(...corners.map((p) => p.y));
15309
+ const textCenterX = decomposed.translateX ?? absoluteLeft;
15310
+ const textCenterY = decomposed.translateY ?? absoluteTop;
15311
+ const theta = fabric.util.degreesToRadians(decomposed.angle ?? 0);
15312
+ const cos = Math.cos(theta);
15313
+ const sin = Math.sin(theta);
15314
+ absoluteLeft = textCenterX - (cos * finalWidth / 2 - sin * finalHeight / 2);
15315
+ absoluteTop = textCenterY - (sin * finalWidth / 2 + cos * finalHeight / 2);
15339
15316
  } catch {
15340
15317
  }
15341
15318
  finalAbsoluteMatrix = fabric.util.composeMatrix({
@@ -24614,9 +24591,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24614
24591
  }
24615
24592
  return svgString;
24616
24593
  }
24617
- const resolvedPackageVersion = "0.5.361";
24594
+ const resolvedPackageVersion = "0.5.363";
24618
24595
  const PACKAGE_VERSION = resolvedPackageVersion;
24619
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.361";
24596
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.363";
24620
24597
  const roundParityValue = (value) => {
24621
24598
  if (typeof value !== "number") return value;
24622
24599
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25430,7 +25407,7 @@ class PixldocsRenderer {
25430
25407
  await this.waitForCanvasScene(container, cloned, i);
25431
25408
  }
25432
25409
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25433
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BvYAPUvD.js");
25410
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DtI5z_ZO.js");
25434
25411
  const prepared = preparePagesForExport(
25435
25412
  cloned.pages,
25436
25413
  canvasWidth,
@@ -27750,7 +27727,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27750
27727
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27751
27728
  sanitizeSvgTreeForPdf(svgToDraw);
27752
27729
  try {
27753
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BvYAPUvD.js");
27730
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DtI5z_ZO.js");
27754
27731
  try {
27755
27732
  await logTextMeasurementDiagnostic(svgToDraw);
27756
27733
  } catch {
@@ -28150,4 +28127,4 @@ export {
28150
28127
  buildTeaserBlurFlatKeys as y,
28151
28128
  collectFontDescriptorsFromConfig as z
28152
28129
  };
28153
- //# sourceMappingURL=index-BaiH8RTh.js.map
28130
+ //# sourceMappingURL=index-Cw161PRH.js.map