@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.
@@ -15214,22 +15214,8 @@ const PageCanvas = react.forwardRef(
15214
15214
  finalScaleX = 1;
15215
15215
  finalScaleY = 1;
15216
15216
  try {
15217
- const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
15218
- const cos = Math.cos(angleRad);
15219
- const sin = Math.sin(angleRad);
15220
- const hw = finalWidth / 2;
15221
- const hh = finalHeight / 2;
15222
- const corners = [
15223
- { x: -hw, y: -hh },
15224
- { x: hw, y: -hh },
15225
- { x: hw, y: hh },
15226
- { x: -hw, y: hh }
15227
- ].map((p) => ({
15228
- x: decomposed.translateX + p.x * cos - p.y * sin,
15229
- y: decomposed.translateY + p.x * sin + p.y * cos
15230
- }));
15231
- absoluteLeft = Math.min(...corners.map((p) => p.x));
15232
- absoluteTop = Math.min(...corners.map((p) => p.y));
15217
+ absoluteLeft = (decomposed.translateX ?? absoluteLeft) - finalWidth / 2;
15218
+ absoluteTop = (decomposed.translateY ?? absoluteTop) - finalHeight / 2;
15233
15219
  } catch {
15234
15220
  }
15235
15221
  finalAbsoluteMatrix = fabric__namespace.util.composeMatrix({
@@ -15338,22 +15324,13 @@ const PageCanvas = react.forwardRef(
15338
15324
  } catch {
15339
15325
  }
15340
15326
  try {
15341
- const angleRad = (decomposed.angle ?? 0) * Math.PI / 180;
15342
- const cos = Math.cos(angleRad);
15343
- const sin = Math.sin(angleRad);
15344
- const hw = finalWidth / 2;
15345
- const hh = finalHeight / 2;
15346
- const corners = [
15347
- { x: -hw, y: -hh },
15348
- { x: hw, y: -hh },
15349
- { x: hw, y: hh },
15350
- { x: -hw, y: hh }
15351
- ].map((p) => ({
15352
- x: decomposed.translateX + p.x * cos - p.y * sin,
15353
- y: decomposed.translateY + p.x * sin + p.y * cos
15354
- }));
15355
- absoluteLeft = Math.min(...corners.map((p) => p.x));
15356
- absoluteTop = Math.min(...corners.map((p) => p.y));
15327
+ const textCenterX = decomposed.translateX ?? absoluteLeft;
15328
+ const textCenterY = decomposed.translateY ?? absoluteTop;
15329
+ const theta = fabric__namespace.util.degreesToRadians(decomposed.angle ?? 0);
15330
+ const cos = Math.cos(theta);
15331
+ const sin = Math.sin(theta);
15332
+ absoluteLeft = textCenterX - (cos * finalWidth / 2 - sin * finalHeight / 2);
15333
+ absoluteTop = textCenterY - (sin * finalWidth / 2 + cos * finalHeight / 2);
15357
15334
  } catch {
15358
15335
  }
15359
15336
  finalAbsoluteMatrix = fabric__namespace.util.composeMatrix({
@@ -24632,9 +24609,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
24632
24609
  }
24633
24610
  return svgString;
24634
24611
  }
24635
- const resolvedPackageVersion = "0.5.361";
24612
+ const resolvedPackageVersion = "0.5.363";
24636
24613
  const PACKAGE_VERSION = resolvedPackageVersion;
24637
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.361";
24614
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.363";
24638
24615
  const roundParityValue = (value) => {
24639
24616
  if (typeof value !== "number") return value;
24640
24617
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -25448,7 +25425,7 @@ class PixldocsRenderer {
25448
25425
  await this.waitForCanvasScene(container, cloned, i);
25449
25426
  }
25450
25427
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
25451
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CTUzYtqL.cjs"));
25428
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DcTlFDUW.cjs"));
25452
25429
  const prepared = preparePagesForExport(
25453
25430
  cloned.pages,
25454
25431
  canvasWidth,
@@ -27768,7 +27745,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
27768
27745
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
27769
27746
  sanitizeSvgTreeForPdf(svgToDraw);
27770
27747
  try {
27771
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CTUzYtqL.cjs"));
27748
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DcTlFDUW.cjs"));
27772
27749
  try {
27773
27750
  await logTextMeasurementDiagnostic(svgToDraw);
27774
27751
  } catch {
@@ -28165,4 +28142,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
28165
28142
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
28166
28143
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
28167
28144
  exports.warmTemplateFromForm = warmTemplateFromForm;
28168
- //# sourceMappingURL=index-CG6KfVLP.cjs.map
28145
+ //# sourceMappingURL=index-2dvR-r9n.cjs.map