@pixldocs/canvas-renderer 0.5.460 → 0.5.462
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.
- package/dist/{index-CtJvkbzV.cjs → index-DjoKgogq.cjs} +45 -15
- package/dist/index-DjoKgogq.cjs.map +1 -0
- package/dist/{index-B306IfvT.js → index-DzpYcUNd.js} +45 -15
- package/dist/index-DzpYcUNd.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-CWiNW81v.js → vectorPdfExport-CFxK100y.js} +30 -8
- package/dist/{vectorPdfExport-CWiNW81v.js.map → vectorPdfExport-CFxK100y.js.map} +1 -1
- package/dist/{vectorPdfExport-B5Xxp9RH.cjs → vectorPdfExport-IjuMSK-o.cjs} +30 -8
- package/dist/{vectorPdfExport-B5Xxp9RH.cjs.map → vectorPdfExport-IjuMSK-o.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B306IfvT.js.map +0 -1
- package/dist/index-CtJvkbzV.cjs.map +0 -1
|
@@ -4413,8 +4413,12 @@ async function loadImageAsync(element, placeholder, fc, fabricRef, syncLockedRef
|
|
|
4413
4413
|
const elementHeight2 = Number(element.height) * (element.scaleY ?? 1);
|
|
4414
4414
|
const scaledImageWidth = imgNaturalWidth * baseScaleX;
|
|
4415
4415
|
const scaledImageHeight = imgNaturalHeight * baseScaleY;
|
|
4416
|
-
const
|
|
4417
|
-
const
|
|
4416
|
+
const alignH = element.imageAlignH ?? "center";
|
|
4417
|
+
const alignV = element.imageAlignV ?? "middle";
|
|
4418
|
+
const slackX = elementWidth2 - scaledImageWidth;
|
|
4419
|
+
const slackY = elementHeight2 - scaledImageHeight;
|
|
4420
|
+
const imageLeft = imageFit2 === "contain" ? alignH === "left" ? 0 : alignH === "right" ? slackX : slackX / 2 : slackX / 2;
|
|
4421
|
+
const imageTop = imageFit2 === "contain" ? alignV === "top" ? 0 : alignV === "bottom" ? slackY : slackY / 2 : slackY / 2;
|
|
4418
4422
|
img.set({
|
|
4419
4423
|
originX: "left",
|
|
4420
4424
|
originY: "top",
|
|
@@ -5213,8 +5217,19 @@ function updateCoverLayout(g) {
|
|
|
5213
5217
|
const overflowY = Math.max(0, dispH - frameH);
|
|
5214
5218
|
const panX = clamp$1(img._ct.panX ?? 0.5, 0, 1);
|
|
5215
5219
|
const panY = clamp$1(img._ct.panY ?? 0.5, 0, 1);
|
|
5216
|
-
|
|
5217
|
-
|
|
5220
|
+
let offsetX = 0;
|
|
5221
|
+
let offsetY = 0;
|
|
5222
|
+
if (fitContain) {
|
|
5223
|
+
const alignH = ct.alignH ?? "center";
|
|
5224
|
+
const alignV = ct.alignV ?? "middle";
|
|
5225
|
+
const slackX = Math.max(0, frameW - dispW);
|
|
5226
|
+
const slackY = Math.max(0, frameH - dispH);
|
|
5227
|
+
offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
5228
|
+
offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
5229
|
+
} else {
|
|
5230
|
+
offsetX = overflowX > 0 ? -overflowX * (panX - 0.5) : 0;
|
|
5231
|
+
offsetY = overflowY > 0 ? -overflowY * (panY - 0.5) : 0;
|
|
5232
|
+
}
|
|
5218
5233
|
img.set({ left: offsetX, top: offsetY });
|
|
5219
5234
|
g.dirty = true;
|
|
5220
5235
|
img.dirty = true;
|
|
@@ -5587,7 +5602,10 @@ async function createMaskedImageElement({
|
|
|
5587
5602
|
visible = true,
|
|
5588
5603
|
panX = 0.5,
|
|
5589
5604
|
panY = 0.5,
|
|
5590
|
-
zoom = 1
|
|
5605
|
+
zoom = 1,
|
|
5606
|
+
fit = "cover",
|
|
5607
|
+
alignH = "center",
|
|
5608
|
+
alignV = "middle"
|
|
5591
5609
|
}) {
|
|
5592
5610
|
const img = image || (url ? await fabric.FabricImage.fromURL(getProxiedImageUrl(url), { crossOrigin: "anonymous" }) : null);
|
|
5593
5611
|
if (!img) {
|
|
@@ -5706,8 +5724,12 @@ async function createMaskedImageElement({
|
|
|
5706
5724
|
rx,
|
|
5707
5725
|
frameW,
|
|
5708
5726
|
frameH,
|
|
5709
|
-
|
|
5710
|
-
//
|
|
5727
|
+
// Honor the element's authored imageFit. When 'contain', the image is
|
|
5728
|
+
// scaled to fit fully inside the frame (no clipping) and alignH/alignV
|
|
5729
|
+
// control where the letterboxed image sits.
|
|
5730
|
+
fit,
|
|
5731
|
+
alignH,
|
|
5732
|
+
alignV,
|
|
5711
5733
|
_img: img,
|
|
5712
5734
|
_border: border
|
|
5713
5735
|
};
|
|
@@ -17096,13 +17118,15 @@ const PageCanvas = forwardRef(
|
|
|
17096
17118
|
}
|
|
17097
17119
|
updateElement(elementId, {
|
|
17098
17120
|
text: newText,
|
|
17099
|
-
...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight }
|
|
17121
|
+
...typeof nextHeight === "number" && nextHeight > 0 && { height: nextHeight },
|
|
17122
|
+
...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
|
|
17100
17123
|
});
|
|
17101
17124
|
} else {
|
|
17102
17125
|
updateElement(elementId, {
|
|
17103
17126
|
text: newText,
|
|
17104
17127
|
...fabricHeight > 0 && { height: fabricHeight },
|
|
17105
|
-
...fabricWidth > 0 && { width: fabricWidth }
|
|
17128
|
+
...fabricWidth > 0 && { width: fabricWidth },
|
|
17129
|
+
...target.styles && Object.keys(target.styles).length > 0 ? { styles: JSON.parse(JSON.stringify(target.styles)) } : {}
|
|
17106
17130
|
});
|
|
17107
17131
|
}
|
|
17108
17132
|
commitHistory2();
|
|
@@ -19614,7 +19638,13 @@ const PageCanvas = forwardRef(
|
|
|
19614
19638
|
visible: !isHidden,
|
|
19615
19639
|
panX,
|
|
19616
19640
|
panY,
|
|
19617
|
-
zoom: zoom2
|
|
19641
|
+
zoom: zoom2,
|
|
19642
|
+
// Honor authored Object Fit + alignment so contain logos render
|
|
19643
|
+
// fully inside the frame, with letterbox aligned to the chosen
|
|
19644
|
+
// edge (instead of being silently cover-cropped).
|
|
19645
|
+
fit: imageFitFinal === "contain" ? "contain" : "cover",
|
|
19646
|
+
alignH: element.imageAlignH ?? "center",
|
|
19647
|
+
alignV: element.imageAlignV ?? "middle"
|
|
19618
19648
|
});
|
|
19619
19649
|
cropGroup.__maintainResolution = element.maintainResolution !== false;
|
|
19620
19650
|
cropGroup.set({
|
|
@@ -26221,9 +26251,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26221
26251
|
}
|
|
26222
26252
|
return svgString;
|
|
26223
26253
|
}
|
|
26224
|
-
const resolvedPackageVersion = "0.5.
|
|
26254
|
+
const resolvedPackageVersion = "0.5.462";
|
|
26225
26255
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26226
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26256
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.462";
|
|
26227
26257
|
const roundParityValue = (value) => {
|
|
26228
26258
|
if (typeof value !== "number") return value;
|
|
26229
26259
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27037,7 +27067,7 @@ class PixldocsRenderer {
|
|
|
27037
27067
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27038
27068
|
}
|
|
27039
27069
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27040
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27070
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CFxK100y.js");
|
|
27041
27071
|
const prepared = preparePagesForExport(
|
|
27042
27072
|
cloned.pages,
|
|
27043
27073
|
canvasWidth,
|
|
@@ -29357,7 +29387,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29357
29387
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29358
29388
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29359
29389
|
try {
|
|
29360
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29390
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CFxK100y.js");
|
|
29361
29391
|
try {
|
|
29362
29392
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29363
29393
|
} catch {
|
|
@@ -29674,4 +29704,4 @@ export {
|
|
|
29674
29704
|
buildTeaserBlurFlatKeys as y,
|
|
29675
29705
|
collectFontDescriptorsFromConfig as z
|
|
29676
29706
|
};
|
|
29677
|
-
//# sourceMappingURL=index-
|
|
29707
|
+
//# sourceMappingURL=index-DzpYcUNd.js.map
|