@pixldocs/canvas-renderer 0.5.464 → 0.5.466
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-TvXdi5B9.js → index-B_lTeUY-.js} +67 -6
- package/dist/index-B_lTeUY-.js.map +1 -0
- package/dist/{index-BFIEinvR.cjs → index-CJitUO8J.cjs} +67 -6
- package/dist/index-CJitUO8J.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-pt3O47hm.js → vectorPdfExport-CYNj9Z_A.js} +4 -4
- package/dist/{vectorPdfExport-pt3O47hm.js.map → vectorPdfExport-CYNj9Z_A.js.map} +1 -1
- package/dist/{vectorPdfExport-BlaglUx4.cjs → vectorPdfExport-DldoIDUl.cjs} +4 -4
- package/dist/{vectorPdfExport-BlaglUx4.cjs.map → vectorPdfExport-DldoIDUl.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-BFIEinvR.cjs.map +0 -1
- package/dist/index-TvXdi5B9.js.map +0 -1
|
@@ -5243,6 +5243,53 @@ function updateCoverLayout(g) {
|
|
|
5243
5243
|
g.canvas.requestRenderAll();
|
|
5244
5244
|
}
|
|
5245
5245
|
}
|
|
5246
|
+
function shrinkContainGroupToImageBounds(g) {
|
|
5247
|
+
const ct = g.__cropData;
|
|
5248
|
+
if (!ct || ct.fit !== "contain") return;
|
|
5249
|
+
const img = ct._img;
|
|
5250
|
+
if (!img) return;
|
|
5251
|
+
const clip = g.clipPath;
|
|
5252
|
+
if (clip && (isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask)) return;
|
|
5253
|
+
const iw = img.width || 0;
|
|
5254
|
+
const ih = img.height || 0;
|
|
5255
|
+
const sx = Math.abs(img.scaleX || 1);
|
|
5256
|
+
const sy = Math.abs(img.scaleY || 1);
|
|
5257
|
+
const dispW = iw * sx;
|
|
5258
|
+
const dispH = ih * sy;
|
|
5259
|
+
if (dispW <= 0 || dispH <= 0) return;
|
|
5260
|
+
const frameW = Number(ct.frameW) || g.width || dispW;
|
|
5261
|
+
const frameH = Number(ct.frameH) || g.height || dispH;
|
|
5262
|
+
const alignH = ct.alignH ?? "center";
|
|
5263
|
+
const alignV = ct.alignV ?? "middle";
|
|
5264
|
+
const slackX = frameW - dispW;
|
|
5265
|
+
const slackY = frameH - dispH;
|
|
5266
|
+
const offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
5267
|
+
const offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
5268
|
+
const angleRad = fabric.util.degreesToRadians(g.angle || 0);
|
|
5269
|
+
const cos = Math.cos(angleRad);
|
|
5270
|
+
const sin = Math.sin(angleRad);
|
|
5271
|
+
const worldDx = offsetX * cos - offsetY * sin;
|
|
5272
|
+
const worldDy = offsetX * sin + offsetY * cos;
|
|
5273
|
+
g.set({
|
|
5274
|
+
left: (g.left || 0) + worldDx,
|
|
5275
|
+
top: (g.top || 0) + worldDy,
|
|
5276
|
+
width: dispW,
|
|
5277
|
+
height: dispH
|
|
5278
|
+
});
|
|
5279
|
+
img.set({ left: 0, top: 0 });
|
|
5280
|
+
if (clip) {
|
|
5281
|
+
if (clip instanceof fabric.Rect) {
|
|
5282
|
+
const rxRatio = Number(ct.rx) || 0;
|
|
5283
|
+
const rxPx = rxRatio > 0.5 ? Math.min(rxRatio, dispW / 2, dispH / 2) : Math.max(0, Math.min(rxRatio * Math.min(dispW, dispH), dispW / 2, dispH / 2));
|
|
5284
|
+
clip.set({ width: dispW, height: dispH, rx: rxPx, ry: rxPx });
|
|
5285
|
+
} else if (clip instanceof fabric.Ellipse) {
|
|
5286
|
+
clip.set({ rx: dispW / 2, ry: dispH / 2 });
|
|
5287
|
+
}
|
|
5288
|
+
clip.dirty = true;
|
|
5289
|
+
}
|
|
5290
|
+
g.dirty = true;
|
|
5291
|
+
g.setCoords();
|
|
5292
|
+
}
|
|
5246
5293
|
function getDomEvent(eventData) {
|
|
5247
5294
|
return (eventData == null ? void 0 : eventData.e) ?? eventData ?? null;
|
|
5248
5295
|
}
|
|
@@ -17467,6 +17514,17 @@ const PageCanvas = forwardRef(
|
|
|
17467
17514
|
const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
|
|
17468
17515
|
const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
|
|
17469
17516
|
const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
|
|
17517
|
+
let cropFrameSizeChanged = false;
|
|
17518
|
+
if (isCropGroup2) {
|
|
17519
|
+
const liveCt = existingObj.__cropData;
|
|
17520
|
+
const liveW = Number(liveCt == null ? void 0 : liveCt.frameW) || 0;
|
|
17521
|
+
const liveH = Number(liveCt == null ? void 0 : liveCt.frameH) || 0;
|
|
17522
|
+
const schemaW = (Number(element.width) || 0) * (Number(element.scaleX) || 1);
|
|
17523
|
+
const schemaH = (Number(element.height) || 0) * (Number(element.scaleY) || 1);
|
|
17524
|
+
if (schemaW > 0 && schemaH > 0 && (Math.abs(schemaW - liveW) > 0.5 || Math.abs(schemaH - liveH) > 0.5)) {
|
|
17525
|
+
cropFrameSizeChanged = true;
|
|
17526
|
+
}
|
|
17527
|
+
}
|
|
17470
17528
|
const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
|
|
17471
17529
|
if (!hasUrl && hadUrlBefore) {
|
|
17472
17530
|
const resolvedSizeImg = (pageChildren == null ? void 0 : pageChildren.length) ? getNodeBounds(element, pageChildren) : { width: typeof element.width === "number" ? element.width : 200, height: typeof element.height === "number" ? element.height : 50 };
|
|
@@ -17503,7 +17561,7 @@ const PageCanvas = forwardRef(
|
|
|
17503
17561
|
const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
|
|
17504
17562
|
const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
|
|
17505
17563
|
const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
|
|
17506
|
-
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
|
|
17564
|
+
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate || cropFrameSizeChanged)) {
|
|
17507
17565
|
if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
|
|
17508
17566
|
loadImageAsync2(element, existingObj, fc);
|
|
17509
17567
|
} else if (plainImageNeedsCropGroup) {
|
|
@@ -17623,6 +17681,7 @@ const PageCanvas = forwardRef(
|
|
|
17623
17681
|
ct.fit = elFit;
|
|
17624
17682
|
}
|
|
17625
17683
|
updateCoverLayout(existingObj);
|
|
17684
|
+
shrinkContainGroupToImageBounds(existingObj);
|
|
17626
17685
|
applyEdgeFadeFrameClipPath(existingObj, element, ct.frameW, ct.frameH, ct.shape || "rect", ct.rx || 0);
|
|
17627
17686
|
if (allowEditing) {
|
|
17628
17687
|
installImageResizeControlsWithSnap(existingObj);
|
|
@@ -17730,6 +17789,7 @@ const PageCanvas = forwardRef(
|
|
|
17730
17789
|
ctSync.alignV = element.imageAlignV ?? "middle";
|
|
17731
17790
|
ctSync.containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
17732
17791
|
updateCoverLayout(existingObj);
|
|
17792
|
+
shrinkContainGroupToImageBounds(existingObj);
|
|
17733
17793
|
existingObj.dirty = true;
|
|
17734
17794
|
}
|
|
17735
17795
|
}
|
|
@@ -19696,6 +19756,7 @@ const PageCanvas = forwardRef(
|
|
|
19696
19756
|
updateCoverLayout(cropGroup);
|
|
19697
19757
|
}
|
|
19698
19758
|
applyEdgeFadeFrameClipPath(cropGroup, element, frameW, frameH, shape, rxRatio);
|
|
19759
|
+
shrinkContainGroupToImageBounds(cropGroup);
|
|
19699
19760
|
setObjectData(cropGroup, element.id);
|
|
19700
19761
|
cropGroup.__imageElement = cropImg;
|
|
19701
19762
|
cropGroup.__imageSrc = imageUrl;
|
|
@@ -26279,9 +26340,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26279
26340
|
}
|
|
26280
26341
|
return svgString;
|
|
26281
26342
|
}
|
|
26282
|
-
const resolvedPackageVersion = "0.5.
|
|
26343
|
+
const resolvedPackageVersion = "0.5.466";
|
|
26283
26344
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26284
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26345
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.466";
|
|
26285
26346
|
const roundParityValue = (value) => {
|
|
26286
26347
|
if (typeof value !== "number") return value;
|
|
26287
26348
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27095,7 +27156,7 @@ class PixldocsRenderer {
|
|
|
27095
27156
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27096
27157
|
}
|
|
27097
27158
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27098
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27159
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-CYNj9Z_A.js");
|
|
27099
27160
|
const prepared = preparePagesForExport(
|
|
27100
27161
|
cloned.pages,
|
|
27101
27162
|
canvasWidth,
|
|
@@ -29415,7 +29476,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29415
29476
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29416
29477
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29417
29478
|
try {
|
|
29418
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29479
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-CYNj9Z_A.js");
|
|
29419
29480
|
try {
|
|
29420
29481
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29421
29482
|
} catch {
|
|
@@ -29732,4 +29793,4 @@ export {
|
|
|
29732
29793
|
buildTeaserBlurFlatKeys as y,
|
|
29733
29794
|
collectFontDescriptorsFromConfig as z
|
|
29734
29795
|
};
|
|
29735
|
-
//# sourceMappingURL=index-
|
|
29796
|
+
//# sourceMappingURL=index-B_lTeUY-.js.map
|