@pixldocs/canvas-renderer 0.5.462 → 0.5.463

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.
@@ -4379,7 +4379,8 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
4379
4379
  } else if (imageFit2 === "contain") {
4380
4380
  const scaleX = elementWidth / imgNaturalWidth;
4381
4381
  const scaleY = elementHeight / imgNaturalHeight;
4382
- const scale = Math.min(scaleX, scaleY);
4382
+ const containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
4383
+ const scale = Math.min(scaleX, scaleY) * containScale;
4383
4384
  baseScaleX = scale;
4384
4385
  baseScaleY = scale;
4385
4386
  } else {
@@ -5197,7 +5198,7 @@ function updateCoverLayout(g) {
5197
5198
  const ih = img.height || 1;
5198
5199
  const fitContain = ct.fit === "contain";
5199
5200
  const baseScale = fitContain ? Math.min(frameW / iw, frameH / ih) : Math.max(frameW / iw, frameH / ih);
5200
- const zoom = fitContain ? 1 : Math.max(1, img._ct.zoom ?? 1);
5201
+ const zoom = fitContain ? Math.max(1, Math.min(3, ct.containScale ?? 1)) : Math.max(1, img._ct.zoom ?? 1);
5201
5202
  const finalScale = baseScale * zoom;
5202
5203
  img.set({
5203
5204
  scaleX: finalScale,
@@ -5222,8 +5223,8 @@ function updateCoverLayout(g) {
5222
5223
  if (fitContain) {
5223
5224
  const alignH = ct.alignH ?? "center";
5224
5225
  const alignV = ct.alignV ?? "middle";
5225
- const slackX = Math.max(0, frameW - dispW);
5226
- const slackY = Math.max(0, frameH - dispH);
5226
+ const slackX = frameW - dispW;
5227
+ const slackY = frameH - dispH;
5227
5228
  offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
5228
5229
  offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
5229
5230
  } else {
@@ -5605,7 +5606,8 @@ async function createMaskedImageElement({
5605
5606
  zoom = 1,
5606
5607
  fit = "cover",
5607
5608
  alignH = "center",
5608
- alignV = "middle"
5609
+ alignV = "middle",
5610
+ containScale = 1
5609
5611
  }) {
5610
5612
  const img = image || (url ? await fabric.FabricImage.fromURL(getProxiedImageUrl(url), { crossOrigin: "anonymous" }) : null);
5611
5613
  if (!img) {
@@ -5730,6 +5732,7 @@ async function createMaskedImageElement({
5730
5732
  fit,
5731
5733
  alignH,
5732
5734
  alignV,
5735
+ containScale: Math.max(1, Math.min(3, containScale || 1)),
5733
5736
  _img: img,
5734
5737
  _border: border
5735
5738
  };
@@ -19644,7 +19647,8 @@ const PageCanvas = forwardRef(
19644
19647
  // edge (instead of being silently cover-cropped).
19645
19648
  fit: imageFitFinal === "contain" ? "contain" : "cover",
19646
19649
  alignH: element.imageAlignH ?? "center",
19647
- alignV: element.imageAlignV ?? "middle"
19650
+ alignV: element.imageAlignV ?? "middle",
19651
+ containScale: Math.max(1, Math.min(3, Number(element.containScale ?? 1)))
19648
19652
  });
19649
19653
  cropGroup.__maintainResolution = element.maintainResolution !== false;
19650
19654
  cropGroup.set({
@@ -26251,9 +26255,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26251
26255
  }
26252
26256
  return svgString;
26253
26257
  }
26254
- const resolvedPackageVersion = "0.5.462";
26258
+ const resolvedPackageVersion = "0.5.463";
26255
26259
  const PACKAGE_VERSION = resolvedPackageVersion;
26256
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.462";
26260
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.463";
26257
26261
  const roundParityValue = (value) => {
26258
26262
  if (typeof value !== "number") return value;
26259
26263
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27067,7 +27071,7 @@ class PixldocsRenderer {
27067
27071
  await this.waitForCanvasScene(container, cloned, i);
27068
27072
  }
27069
27073
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27070
- const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CFxK100y.js");
27074
+ const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BlCi6g1y.js");
27071
27075
  const prepared = preparePagesForExport(
27072
27076
  cloned.pages,
27073
27077
  canvasWidth,
@@ -29387,7 +29391,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29387
29391
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29388
29392
  sanitizeSvgTreeForPdf(svgToDraw);
29389
29393
  try {
29390
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CFxK100y.js");
29394
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BlCi6g1y.js");
29391
29395
  try {
29392
29396
  await logTextMeasurementDiagnostic(svgToDraw);
29393
29397
  } catch {
@@ -29704,4 +29708,4 @@ export {
29704
29708
  buildTeaserBlurFlatKeys as y,
29705
29709
  collectFontDescriptorsFromConfig as z
29706
29710
  };
29707
- //# sourceMappingURL=index-DzpYcUNd.js.map
29711
+ //# sourceMappingURL=index-CJ3vY_6d.js.map