@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.
@@ -4397,7 +4397,8 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
4397
4397
  } else if (imageFit2 === "contain") {
4398
4398
  const scaleX = elementWidth / imgNaturalWidth;
4399
4399
  const scaleY = elementHeight / imgNaturalHeight;
4400
- const scale = Math.min(scaleX, scaleY);
4400
+ const containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
4401
+ const scale = Math.min(scaleX, scaleY) * containScale;
4401
4402
  baseScaleX = scale;
4402
4403
  baseScaleY = scale;
4403
4404
  } else {
@@ -5215,7 +5216,7 @@ function updateCoverLayout(g) {
5215
5216
  const ih = img.height || 1;
5216
5217
  const fitContain = ct.fit === "contain";
5217
5218
  const baseScale = fitContain ? Math.min(frameW / iw, frameH / ih) : Math.max(frameW / iw, frameH / ih);
5218
- const zoom = fitContain ? 1 : Math.max(1, img._ct.zoom ?? 1);
5219
+ const zoom = fitContain ? Math.max(1, Math.min(3, ct.containScale ?? 1)) : Math.max(1, img._ct.zoom ?? 1);
5219
5220
  const finalScale = baseScale * zoom;
5220
5221
  img.set({
5221
5222
  scaleX: finalScale,
@@ -5240,8 +5241,8 @@ function updateCoverLayout(g) {
5240
5241
  if (fitContain) {
5241
5242
  const alignH = ct.alignH ?? "center";
5242
5243
  const alignV = ct.alignV ?? "middle";
5243
- const slackX = Math.max(0, frameW - dispW);
5244
- const slackY = Math.max(0, frameH - dispH);
5244
+ const slackX = frameW - dispW;
5245
+ const slackY = frameH - dispH;
5245
5246
  offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
5246
5247
  offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
5247
5248
  } else {
@@ -5623,7 +5624,8 @@ async function createMaskedImageElement({
5623
5624
  zoom = 1,
5624
5625
  fit = "cover",
5625
5626
  alignH = "center",
5626
- alignV = "middle"
5627
+ alignV = "middle",
5628
+ containScale = 1
5627
5629
  }) {
5628
5630
  const img = image || (url ? await fabric__namespace.FabricImage.fromURL(getProxiedImageUrl(url), { crossOrigin: "anonymous" }) : null);
5629
5631
  if (!img) {
@@ -5748,6 +5750,7 @@ async function createMaskedImageElement({
5748
5750
  fit,
5749
5751
  alignH,
5750
5752
  alignV,
5753
+ containScale: Math.max(1, Math.min(3, containScale || 1)),
5751
5754
  _img: img,
5752
5755
  _border: border
5753
5756
  };
@@ -19662,7 +19665,8 @@ const PageCanvas = react.forwardRef(
19662
19665
  // edge (instead of being silently cover-cropped).
19663
19666
  fit: imageFitFinal === "contain" ? "contain" : "cover",
19664
19667
  alignH: element.imageAlignH ?? "center",
19665
- alignV: element.imageAlignV ?? "middle"
19668
+ alignV: element.imageAlignV ?? "middle",
19669
+ containScale: Math.max(1, Math.min(3, Number(element.containScale ?? 1)))
19666
19670
  });
19667
19671
  cropGroup.__maintainResolution = element.maintainResolution !== false;
19668
19672
  cropGroup.set({
@@ -26269,9 +26273,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
26269
26273
  }
26270
26274
  return svgString;
26271
26275
  }
26272
- const resolvedPackageVersion = "0.5.462";
26276
+ const resolvedPackageVersion = "0.5.463";
26273
26277
  const PACKAGE_VERSION = resolvedPackageVersion;
26274
- const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.462";
26278
+ const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.463";
26275
26279
  const roundParityValue = (value) => {
26276
26280
  if (typeof value !== "number") return value;
26277
26281
  return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
@@ -27085,7 +27089,7 @@ class PixldocsRenderer {
27085
27089
  await this.waitForCanvasScene(container, cloned, i);
27086
27090
  }
27087
27091
  console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
27088
- const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-IjuMSK-o.cjs"));
27092
+ const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DFhh1h5p.cjs"));
27089
27093
  const prepared = preparePagesForExport(
27090
27094
  cloned.pages,
27091
27095
  canvasWidth,
@@ -29405,7 +29409,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
29405
29409
  if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
29406
29410
  sanitizeSvgTreeForPdf(svgToDraw);
29407
29411
  try {
29408
- const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-IjuMSK-o.cjs"));
29412
+ const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DFhh1h5p.cjs"));
29409
29413
  try {
29410
29414
  await logTextMeasurementDiagnostic(svgToDraw);
29411
29415
  } catch {
@@ -29719,4 +29723,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
29719
29723
  exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
29720
29724
  exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
29721
29725
  exports.warmTemplateFromForm = warmTemplateFromForm;
29722
- //# sourceMappingURL=index-DjoKgogq.cjs.map
29726
+ //# sourceMappingURL=index-kf9OkhGi.cjs.map