@pixldocs/canvas-renderer 0.5.234 → 0.5.235

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.
@@ -8007,7 +8007,24 @@ function computeBgRects(obj, w, h, pT, pR, pB, pL, fit) {
8007
8007
  const halfW = w / 2;
8008
8008
  const halfH = h / 2;
8009
8009
  const lineHeightRatio = Math.max(0.01, Number((obj == null ? void 0 : obj.lineHeight) ?? 1) || 1);
8010
- let cursorY = -halfH;
8010
+ const valign = (obj == null ? void 0 : obj.verticalAlign) || "top";
8011
+ let contentH = 0;
8012
+ for (let i = 0; i < lines.length; i++) {
8013
+ try {
8014
+ contentH += obj.getHeightOfLine(i) || 0;
8015
+ } catch {
8016
+ }
8017
+ }
8018
+ if (lines.length > 0) {
8019
+ try {
8020
+ const lastH = obj.getHeightOfLine(lines.length - 1) || 0;
8021
+ contentH -= lastH - lastH / lineHeightRatio;
8022
+ } catch {
8023
+ }
8024
+ }
8025
+ const verticalPadding = Math.max(0, h - contentH);
8026
+ const valignOffset = valign === "middle" ? verticalPadding / 2 : valign === "bottom" ? verticalPadding : 0;
8027
+ let cursorY = -halfH + valignOffset;
8011
8028
  for (let i = 0; i < lines.length; i++) {
8012
8029
  let lineW = 0;
8013
8030
  let lineLeft = 0;
@@ -8029,7 +8046,8 @@ function computeBgRects(obj, w, h, pT, pR, pB, pL, fit) {
8029
8046
  }
8030
8047
  const rawSlotH = i === lines.length - 1 ? lineH / lineHeightRatio : lineH;
8031
8048
  const usedH = cursorY + halfH;
8032
- const slotH = Math.max(0, Math.min(rawSlotH, h - usedH));
8049
+ const remaining = h - usedH;
8050
+ const slotH = Math.max(0, Math.min(rawSlotH, remaining));
8033
8051
  if (lineW <= 0 || slotH <= 0) {
8034
8052
  cursorY += slotH;
8035
8053
  continue;
@@ -21097,9 +21115,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
21097
21115
  }
21098
21116
  return svgString;
21099
21117
  }
21100
- const resolvedPackageVersion = "0.5.234";
21118
+ const resolvedPackageVersion = "0.5.235";
21101
21119
  const PACKAGE_VERSION = resolvedPackageVersion;
21102
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.234";
21120
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.235";
21103
21121
  const roundParityValue = (value) => {
21104
21122
  if (typeof value !== "number") return value;
21105
21123
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -21843,7 +21861,7 @@ class PixldocsRenderer {
21843
21861
  await this.waitForCanvasScene(container, cloned, i);
21844
21862
  }
21845
21863
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
21846
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DZm2JXde.js");
21864
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-DzgUFIK9.js");
21847
21865
  const prepared = preparePagesForExport(
21848
21866
  cloned.pages,
21849
21867
  canvasWidth,
@@ -24163,7 +24181,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
24163
24181
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
24164
24182
  sanitizeSvgTreeForPdf(svgToDraw);
24165
24183
  try {
24166
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DZm2JXde.js");
24184
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-DzgUFIK9.js");
24167
24185
  try {
24168
24186
  await logTextMeasurementDiagnostic(svgToDraw);
24169
24187
  } catch {
@@ -24563,4 +24581,4 @@ export {
24563
24581
  buildTeaserBlurFlatKeys as y,
24564
24582
  collectFontDescriptorsFromConfig as z
24565
24583
  };
24566
- //# sourceMappingURL=index-BStk6K2C.js.map
24584
+ //# sourceMappingURL=index-B8RvBKaU.js.map