@pixldocs/canvas-renderer 0.5.466 → 0.5.467
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-CJitUO8J.cjs → index-JJbf0DOF.cjs} +22 -67
- package/dist/index-JJbf0DOF.cjs.map +1 -0
- package/dist/{index-B_lTeUY-.js → index-MX3VJ8nQ.js} +22 -67
- package/dist/index-MX3VJ8nQ.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-DldoIDUl.cjs → vectorPdfExport-CYxG1Qy-.cjs} +4 -4
- package/dist/{vectorPdfExport-DldoIDUl.cjs.map → vectorPdfExport-CYxG1Qy-.cjs.map} +1 -1
- package/dist/{vectorPdfExport-CYNj9Z_A.js → vectorPdfExport-v-hlKrdw.js} +4 -4
- package/dist/{vectorPdfExport-CYNj9Z_A.js.map → vectorPdfExport-v-hlKrdw.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-B_lTeUY-.js.map +0 -1
- package/dist/index-CJitUO8J.cjs.map +0 -1
|
@@ -5237,59 +5237,28 @@ function updateCoverLayout(g) {
|
|
|
5237
5237
|
if (g.clipPath) {
|
|
5238
5238
|
g.clipPath.dirty = true;
|
|
5239
5239
|
}
|
|
5240
|
+
if (fitContain && g.clipPath) {
|
|
5241
|
+
const clip = g.clipPath;
|
|
5242
|
+
const isSpecialMask = isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask;
|
|
5243
|
+
if (!isSpecialMask) {
|
|
5244
|
+
const clipW = Math.max(frameW, dispW);
|
|
5245
|
+
const clipH = Math.max(frameH, dispH);
|
|
5246
|
+
if (clip instanceof fabric.Rect) {
|
|
5247
|
+
const rxRatioCt = Number(ct.rx) || 0;
|
|
5248
|
+
const rxPx = rxRatioCt > 0.5 ? Math.min(rxRatioCt, clipW / 2, clipH / 2) : Math.max(0, Math.min(rxRatioCt * Math.min(clipW, clipH), clipW / 2, clipH / 2));
|
|
5249
|
+
clip.set({ width: clipW, height: clipH, rx: rxPx, ry: rxPx, left: offsetX, top: offsetY });
|
|
5250
|
+
} else if (clip instanceof fabric.Ellipse) {
|
|
5251
|
+
clip.set({ rx: clipW / 2, ry: clipH / 2, left: offsetX, top: offsetY });
|
|
5252
|
+
}
|
|
5253
|
+
clip.dirty = true;
|
|
5254
|
+
}
|
|
5255
|
+
}
|
|
5240
5256
|
finalizeCropGroupCoords(g);
|
|
5241
5257
|
if (g.canvas) {
|
|
5242
5258
|
g.setCoords();
|
|
5243
5259
|
g.canvas.requestRenderAll();
|
|
5244
5260
|
}
|
|
5245
5261
|
}
|
|
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
|
-
}
|
|
5293
5262
|
function getDomEvent(eventData) {
|
|
5294
5263
|
return (eventData == null ? void 0 : eventData.e) ?? eventData ?? null;
|
|
5295
5264
|
}
|
|
@@ -17514,17 +17483,6 @@ const PageCanvas = forwardRef(
|
|
|
17514
17483
|
const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
|
|
17515
17484
|
const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
|
|
17516
17485
|
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
|
-
}
|
|
17528
17486
|
const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
|
|
17529
17487
|
if (!hasUrl && hadUrlBefore) {
|
|
17530
17488
|
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 };
|
|
@@ -17561,7 +17519,7 @@ const PageCanvas = forwardRef(
|
|
|
17561
17519
|
const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
|
|
17562
17520
|
const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
|
|
17563
17521
|
const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric.FabricImage && needCropGroupForElement;
|
|
17564
|
-
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate
|
|
17522
|
+
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
|
|
17565
17523
|
if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
|
|
17566
17524
|
loadImageAsync2(element, existingObj, fc);
|
|
17567
17525
|
} else if (plainImageNeedsCropGroup) {
|
|
@@ -17681,7 +17639,6 @@ const PageCanvas = forwardRef(
|
|
|
17681
17639
|
ct.fit = elFit;
|
|
17682
17640
|
}
|
|
17683
17641
|
updateCoverLayout(existingObj);
|
|
17684
|
-
shrinkContainGroupToImageBounds(existingObj);
|
|
17685
17642
|
applyEdgeFadeFrameClipPath(existingObj, element, ct.frameW, ct.frameH, ct.shape || "rect", ct.rx || 0);
|
|
17686
17643
|
if (allowEditing) {
|
|
17687
17644
|
installImageResizeControlsWithSnap(existingObj);
|
|
@@ -17789,7 +17746,6 @@ const PageCanvas = forwardRef(
|
|
|
17789
17746
|
ctSync.alignV = element.imageAlignV ?? "middle";
|
|
17790
17747
|
ctSync.containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
17791
17748
|
updateCoverLayout(existingObj);
|
|
17792
|
-
shrinkContainGroupToImageBounds(existingObj);
|
|
17793
17749
|
existingObj.dirty = true;
|
|
17794
17750
|
}
|
|
17795
17751
|
}
|
|
@@ -19756,7 +19712,6 @@ const PageCanvas = forwardRef(
|
|
|
19756
19712
|
updateCoverLayout(cropGroup);
|
|
19757
19713
|
}
|
|
19758
19714
|
applyEdgeFadeFrameClipPath(cropGroup, element, frameW, frameH, shape, rxRatio);
|
|
19759
|
-
shrinkContainGroupToImageBounds(cropGroup);
|
|
19760
19715
|
setObjectData(cropGroup, element.id);
|
|
19761
19716
|
cropGroup.__imageElement = cropImg;
|
|
19762
19717
|
cropGroup.__imageSrc = imageUrl;
|
|
@@ -26340,9 +26295,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26340
26295
|
}
|
|
26341
26296
|
return svgString;
|
|
26342
26297
|
}
|
|
26343
|
-
const resolvedPackageVersion = "0.5.
|
|
26298
|
+
const resolvedPackageVersion = "0.5.467";
|
|
26344
26299
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26345
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26300
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.467";
|
|
26346
26301
|
const roundParityValue = (value) => {
|
|
26347
26302
|
if (typeof value !== "number") return value;
|
|
26348
26303
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27156,7 +27111,7 @@ class PixldocsRenderer {
|
|
|
27156
27111
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27157
27112
|
}
|
|
27158
27113
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27159
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27114
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-v-hlKrdw.js");
|
|
27160
27115
|
const prepared = preparePagesForExport(
|
|
27161
27116
|
cloned.pages,
|
|
27162
27117
|
canvasWidth,
|
|
@@ -29476,7 +29431,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29476
29431
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29477
29432
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29478
29433
|
try {
|
|
29479
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29434
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-v-hlKrdw.js");
|
|
29480
29435
|
try {
|
|
29481
29436
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29482
29437
|
} catch {
|
|
@@ -29793,4 +29748,4 @@ export {
|
|
|
29793
29748
|
buildTeaserBlurFlatKeys as y,
|
|
29794
29749
|
collectFontDescriptorsFromConfig as z
|
|
29795
29750
|
};
|
|
29796
|
-
//# sourceMappingURL=index-
|
|
29751
|
+
//# sourceMappingURL=index-MX3VJ8nQ.js.map
|