@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.
@@ -8025,7 +8025,24 @@ function computeBgRects(obj, w, h, pT, pR, pB, pL, fit) {
8025
8025
  const halfW = w / 2;
8026
8026
  const halfH = h / 2;
8027
8027
  const lineHeightRatio = Math.max(0.01, Number((obj == null ? void 0 : obj.lineHeight) ?? 1) || 1);
8028
- let cursorY = -halfH;
8028
+ const valign = (obj == null ? void 0 : obj.verticalAlign) || "top";
8029
+ let contentH = 0;
8030
+ for (let i = 0; i < lines.length; i++) {
8031
+ try {
8032
+ contentH += obj.getHeightOfLine(i) || 0;
8033
+ } catch {
8034
+ }
8035
+ }
8036
+ if (lines.length > 0) {
8037
+ try {
8038
+ const lastH = obj.getHeightOfLine(lines.length - 1) || 0;
8039
+ contentH -= lastH - lastH / lineHeightRatio;
8040
+ } catch {
8041
+ }
8042
+ }
8043
+ const verticalPadding = Math.max(0, h - contentH);
8044
+ const valignOffset = valign === "middle" ? verticalPadding / 2 : valign === "bottom" ? verticalPadding : 0;
8045
+ let cursorY = -halfH + valignOffset;
8029
8046
  for (let i = 0; i < lines.length; i++) {
8030
8047
  let lineW = 0;
8031
8048
  let lineLeft = 0;
@@ -8047,7 +8064,8 @@ function computeBgRects(obj, w, h, pT, pR, pB, pL, fit) {
8047
8064
  }
8048
8065
  const rawSlotH = i === lines.length - 1 ? lineH / lineHeightRatio : lineH;
8049
8066
  const usedH = cursorY + halfH;
8050
- const slotH = Math.max(0, Math.min(rawSlotH, h - usedH));
8067
+ const remaining = h - usedH;
8068
+ const slotH = Math.max(0, Math.min(rawSlotH, remaining));
8051
8069
  if (lineW <= 0 || slotH <= 0) {
8052
8070
  cursorY += slotH;
8053
8071
  continue;
@@ -21115,9 +21133,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
21115
21133
  }
21116
21134
  return svgString;
21117
21135
  }
21118
- const resolvedPackageVersion = "0.5.234";
21136
+ const resolvedPackageVersion = "0.5.235";
21119
21137
  const PACKAGE_VERSION = resolvedPackageVersion;
21120
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.234";
21138
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.235";
21121
21139
  const roundParityValue = (value) => {
21122
21140
  if (typeof value !== "number") return value;
21123
21141
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -21861,7 +21879,7 @@ class PixldocsRenderer {
21861
21879
  await this.waitForCanvasScene(container, cloned, i);
21862
21880
  }
21863
21881
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
21864
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-Bf3z99NE.cjs"));
21882
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BtoxAWSs.cjs"));
21865
21883
  const prepared = preparePagesForExport(
21866
21884
  cloned.pages,
21867
21885
  canvasWidth,
@@ -24181,7 +24199,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
24181
24199
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
24182
24200
  sanitizeSvgTreeForPdf(svgToDraw);
24183
24201
  try {
24184
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-Bf3z99NE.cjs"));
24202
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BtoxAWSs.cjs"));
24185
24203
  try {
24186
24204
  await logTextMeasurementDiagnostic(svgToDraw);
24187
24205
  } catch {
@@ -24578,4 +24596,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
24578
24596
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
24579
24597
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
24580
24598
  exports.warmTemplateFromForm = warmTemplateFromForm;
24581
- //# sourceMappingURL=index-DQRByRIO.cjs.map
24599
+ //# sourceMappingURL=index-CFIdusRV.cjs.map