@pixldocs/canvas-renderer 0.5.462 → 0.5.464
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-DjoKgogq.cjs → index-BFIEinvR.cjs} +44 -16
- package/dist/index-BFIEinvR.cjs.map +1 -0
- package/dist/{index-DzpYcUNd.js → index-TvXdi5B9.js} +44 -16
- package/dist/index-TvXdi5B9.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-IjuMSK-o.cjs → vectorPdfExport-BlaglUx4.cjs} +12 -10
- package/dist/{vectorPdfExport-IjuMSK-o.cjs.map → vectorPdfExport-BlaglUx4.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CFxK100y.js → vectorPdfExport-pt3O47hm.js} +12 -10
- package/dist/{vectorPdfExport-CFxK100y.js.map → vectorPdfExport-pt3O47hm.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-DjoKgogq.cjs.map +0 -1
- package/dist/index-DzpYcUNd.js.map +0 -1
|
@@ -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
|
|
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 =
|
|
5244
|
-
const slackY =
|
|
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
|
};
|
|
@@ -17249,7 +17252,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17249
17252
|
visibilityUpdateInProgressRef.current = false;
|
|
17250
17253
|
}
|
|
17251
17254
|
doSyncRef.current = () => {
|
|
17252
|
-
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
17255
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
17253
17256
|
const shouldSkipUpdates2 = syncLockedRef.current || editLockRef.current;
|
|
17254
17257
|
const state = useEditorStore.getState();
|
|
17255
17258
|
const elementsToSync = elements;
|
|
@@ -17628,6 +17631,15 @@ const PageCanvas = react.forwardRef(
|
|
|
17628
17631
|
existingObj.clipPath = newClip;
|
|
17629
17632
|
}
|
|
17630
17633
|
}
|
|
17634
|
+
const elFit = element.imageFit ?? ((_h = element.style) == null ? void 0 : _h.imageFit);
|
|
17635
|
+
if (elFit === "contain") {
|
|
17636
|
+
ct.fit = "contain";
|
|
17637
|
+
ct.alignH = element.imageAlignH ?? "center";
|
|
17638
|
+
ct.alignV = element.imageAlignV ?? "middle";
|
|
17639
|
+
ct.containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
17640
|
+
} else if (elFit) {
|
|
17641
|
+
ct.fit = elFit;
|
|
17642
|
+
}
|
|
17631
17643
|
updateCoverLayout(existingObj);
|
|
17632
17644
|
applyEdgeFadeFrameClipPath(existingObj, element, ct.frameW, ct.frameH, ct.shape || "rect", ct.rx || 0);
|
|
17633
17645
|
if (allowEditing) {
|
|
@@ -17726,6 +17738,21 @@ const PageCanvas = react.forwardRef(
|
|
|
17726
17738
|
flipY: element.flipY ?? false,
|
|
17727
17739
|
opacity: isHidden ? 0 : element.opacity ?? 1
|
|
17728
17740
|
});
|
|
17741
|
+
try {
|
|
17742
|
+
const ctSync = existingObj.__cropData;
|
|
17743
|
+
if (ctSync) {
|
|
17744
|
+
const elFitSync = element.imageFit ?? ((_i = element.style) == null ? void 0 : _i.imageFit);
|
|
17745
|
+
if (elFitSync === "contain") {
|
|
17746
|
+
ctSync.fit = "contain";
|
|
17747
|
+
ctSync.alignH = element.imageAlignH ?? "center";
|
|
17748
|
+
ctSync.alignV = element.imageAlignV ?? "middle";
|
|
17749
|
+
ctSync.containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
17750
|
+
updateCoverLayout(existingObj);
|
|
17751
|
+
existingObj.dirty = true;
|
|
17752
|
+
}
|
|
17753
|
+
}
|
|
17754
|
+
} catch {
|
|
17755
|
+
}
|
|
17729
17756
|
existingObj.setCoords();
|
|
17730
17757
|
fc.requestRenderAll();
|
|
17731
17758
|
if (wasJustModified) justModifiedIdsRef.current.delete(element.id);
|
|
@@ -17945,7 +17972,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17945
17972
|
fc.add(placeholder);
|
|
17946
17973
|
fc.bringObjectToFront(placeholder);
|
|
17947
17974
|
const activeObj = fc.getActiveObject();
|
|
17948
|
-
if (activeObj && (((
|
|
17975
|
+
if (activeObj && (((_j = activeObj._ct) == null ? void 0 : _j.isCropGroup) || activeObj.__cropGroup)) {
|
|
17949
17976
|
fc.setActiveObject(activeObj);
|
|
17950
17977
|
}
|
|
17951
17978
|
placeholder.dirty = true;
|
|
@@ -17985,7 +18012,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17985
18012
|
fc.add(obj);
|
|
17986
18013
|
fc.bringObjectToFront(obj);
|
|
17987
18014
|
const activeObj = fc.getActiveObject();
|
|
17988
|
-
if (activeObj && (((
|
|
18015
|
+
if (activeObj && (((_k = activeObj._ct) == null ? void 0 : _k.isCropGroup) || activeObj.__cropGroup)) {
|
|
17989
18016
|
fc.setActiveObject(activeObj);
|
|
17990
18017
|
}
|
|
17991
18018
|
obj.dirty = true;
|
|
@@ -18018,7 +18045,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18018
18045
|
isRebuildingRef.current = false;
|
|
18019
18046
|
fc.requestRenderAll();
|
|
18020
18047
|
if (activeBeforeSync && fc.getObjects().includes(activeBeforeSync)) {
|
|
18021
|
-
const isCropGroup2 = ((
|
|
18048
|
+
const isCropGroup2 = ((_l = activeBeforeSync._ct) == null ? void 0 : _l.isCropGroup) || activeBeforeSync.__cropGroup;
|
|
18022
18049
|
if (isCropGroup2) {
|
|
18023
18050
|
fc.setActiveObject(activeBeforeSync);
|
|
18024
18051
|
fc.requestRenderAll();
|
|
@@ -18105,7 +18132,7 @@ const PageCanvas = react.forwardRef(
|
|
|
18105
18132
|
}
|
|
18106
18133
|
if (fc.__activeEditingGroupId) {
|
|
18107
18134
|
try {
|
|
18108
|
-
(
|
|
18135
|
+
(_m = fc.__updateDrilledGroupOutline) == null ? void 0 : _m.call(fc);
|
|
18109
18136
|
} catch {
|
|
18110
18137
|
}
|
|
18111
18138
|
}
|
|
@@ -19662,7 +19689,8 @@ const PageCanvas = react.forwardRef(
|
|
|
19662
19689
|
// edge (instead of being silently cover-cropped).
|
|
19663
19690
|
fit: imageFitFinal === "contain" ? "contain" : "cover",
|
|
19664
19691
|
alignH: element.imageAlignH ?? "center",
|
|
19665
|
-
alignV: element.imageAlignV ?? "middle"
|
|
19692
|
+
alignV: element.imageAlignV ?? "middle",
|
|
19693
|
+
containScale: Math.max(1, Math.min(3, Number(element.containScale ?? 1)))
|
|
19666
19694
|
});
|
|
19667
19695
|
cropGroup.__maintainResolution = element.maintainResolution !== false;
|
|
19668
19696
|
cropGroup.set({
|
|
@@ -26269,9 +26297,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26269
26297
|
}
|
|
26270
26298
|
return svgString;
|
|
26271
26299
|
}
|
|
26272
|
-
const resolvedPackageVersion = "0.5.
|
|
26300
|
+
const resolvedPackageVersion = "0.5.464";
|
|
26273
26301
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26274
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26302
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.464";
|
|
26275
26303
|
const roundParityValue = (value) => {
|
|
26276
26304
|
if (typeof value !== "number") return value;
|
|
26277
26305
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27085,7 +27113,7 @@ class PixldocsRenderer {
|
|
|
27085
27113
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27086
27114
|
}
|
|
27087
27115
|
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-
|
|
27116
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-BlaglUx4.cjs"));
|
|
27089
27117
|
const prepared = preparePagesForExport(
|
|
27090
27118
|
cloned.pages,
|
|
27091
27119
|
canvasWidth,
|
|
@@ -29405,7 +29433,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29405
29433
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29406
29434
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29407
29435
|
try {
|
|
29408
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29436
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-BlaglUx4.cjs"));
|
|
29409
29437
|
try {
|
|
29410
29438
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29411
29439
|
} catch {
|
|
@@ -29719,4 +29747,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29719
29747
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29720
29748
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29721
29749
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29722
|
-
//# sourceMappingURL=index-
|
|
29750
|
+
//# sourceMappingURL=index-BFIEinvR.cjs.map
|