@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
|
@@ -5255,59 +5255,28 @@ function updateCoverLayout(g) {
|
|
|
5255
5255
|
if (g.clipPath) {
|
|
5256
5256
|
g.clipPath.dirty = true;
|
|
5257
5257
|
}
|
|
5258
|
+
if (fitContain && g.clipPath) {
|
|
5259
|
+
const clip = g.clipPath;
|
|
5260
|
+
const isSpecialMask = isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask;
|
|
5261
|
+
if (!isSpecialMask) {
|
|
5262
|
+
const clipW = Math.max(frameW, dispW);
|
|
5263
|
+
const clipH = Math.max(frameH, dispH);
|
|
5264
|
+
if (clip instanceof fabric__namespace.Rect) {
|
|
5265
|
+
const rxRatioCt = Number(ct.rx) || 0;
|
|
5266
|
+
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));
|
|
5267
|
+
clip.set({ width: clipW, height: clipH, rx: rxPx, ry: rxPx, left: offsetX, top: offsetY });
|
|
5268
|
+
} else if (clip instanceof fabric__namespace.Ellipse) {
|
|
5269
|
+
clip.set({ rx: clipW / 2, ry: clipH / 2, left: offsetX, top: offsetY });
|
|
5270
|
+
}
|
|
5271
|
+
clip.dirty = true;
|
|
5272
|
+
}
|
|
5273
|
+
}
|
|
5258
5274
|
finalizeCropGroupCoords(g);
|
|
5259
5275
|
if (g.canvas) {
|
|
5260
5276
|
g.setCoords();
|
|
5261
5277
|
g.canvas.requestRenderAll();
|
|
5262
5278
|
}
|
|
5263
5279
|
}
|
|
5264
|
-
function shrinkContainGroupToImageBounds(g) {
|
|
5265
|
-
const ct = g.__cropData;
|
|
5266
|
-
if (!ct || ct.fit !== "contain") return;
|
|
5267
|
-
const img = ct._img;
|
|
5268
|
-
if (!img) return;
|
|
5269
|
-
const clip = g.clipPath;
|
|
5270
|
-
if (clip && (isSvgMaskClipPath(clip) || isLuminanceMaskClipPath(clip) || clip.__svgMask || clip.__edgeFadeMask)) return;
|
|
5271
|
-
const iw = img.width || 0;
|
|
5272
|
-
const ih = img.height || 0;
|
|
5273
|
-
const sx = Math.abs(img.scaleX || 1);
|
|
5274
|
-
const sy = Math.abs(img.scaleY || 1);
|
|
5275
|
-
const dispW = iw * sx;
|
|
5276
|
-
const dispH = ih * sy;
|
|
5277
|
-
if (dispW <= 0 || dispH <= 0) return;
|
|
5278
|
-
const frameW = Number(ct.frameW) || g.width || dispW;
|
|
5279
|
-
const frameH = Number(ct.frameH) || g.height || dispH;
|
|
5280
|
-
const alignH = ct.alignH ?? "center";
|
|
5281
|
-
const alignV = ct.alignV ?? "middle";
|
|
5282
|
-
const slackX = frameW - dispW;
|
|
5283
|
-
const slackY = frameH - dispH;
|
|
5284
|
-
const offsetX = alignH === "left" ? -slackX / 2 : alignH === "right" ? slackX / 2 : 0;
|
|
5285
|
-
const offsetY = alignV === "top" ? -slackY / 2 : alignV === "bottom" ? slackY / 2 : 0;
|
|
5286
|
-
const angleRad = fabric__namespace.util.degreesToRadians(g.angle || 0);
|
|
5287
|
-
const cos = Math.cos(angleRad);
|
|
5288
|
-
const sin = Math.sin(angleRad);
|
|
5289
|
-
const worldDx = offsetX * cos - offsetY * sin;
|
|
5290
|
-
const worldDy = offsetX * sin + offsetY * cos;
|
|
5291
|
-
g.set({
|
|
5292
|
-
left: (g.left || 0) + worldDx,
|
|
5293
|
-
top: (g.top || 0) + worldDy,
|
|
5294
|
-
width: dispW,
|
|
5295
|
-
height: dispH
|
|
5296
|
-
});
|
|
5297
|
-
img.set({ left: 0, top: 0 });
|
|
5298
|
-
if (clip) {
|
|
5299
|
-
if (clip instanceof fabric__namespace.Rect) {
|
|
5300
|
-
const rxRatio = Number(ct.rx) || 0;
|
|
5301
|
-
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));
|
|
5302
|
-
clip.set({ width: dispW, height: dispH, rx: rxPx, ry: rxPx });
|
|
5303
|
-
} else if (clip instanceof fabric__namespace.Ellipse) {
|
|
5304
|
-
clip.set({ rx: dispW / 2, ry: dispH / 2 });
|
|
5305
|
-
}
|
|
5306
|
-
clip.dirty = true;
|
|
5307
|
-
}
|
|
5308
|
-
g.dirty = true;
|
|
5309
|
-
g.setCoords();
|
|
5310
|
-
}
|
|
5311
5280
|
function getDomEvent(eventData) {
|
|
5312
5281
|
return (eventData == null ? void 0 : eventData.e) ?? eventData ?? null;
|
|
5313
5282
|
}
|
|
@@ -17532,17 +17501,6 @@ const PageCanvas = react.forwardRef(
|
|
|
17532
17501
|
const fadeKeyChanged = newFadeKey !== oldFadeKey || newFadeKey !== innerOldKey || cropFadeRendererMissing;
|
|
17533
17502
|
const needsReload = sourceUrlChanged || colorMapChanged || fadeKeyChanged && !isCropGroup2;
|
|
17534
17503
|
const needsCropGroupFadeUpdate = isCropGroup2 && fadeKeyChanged;
|
|
17535
|
-
let cropFrameSizeChanged = false;
|
|
17536
|
-
if (isCropGroup2) {
|
|
17537
|
-
const liveCt = existingObj.__cropData;
|
|
17538
|
-
const liveW = Number(liveCt == null ? void 0 : liveCt.frameW) || 0;
|
|
17539
|
-
const liveH = Number(liveCt == null ? void 0 : liveCt.frameH) || 0;
|
|
17540
|
-
const schemaW = (Number(element.width) || 0) * (Number(element.scaleX) || 1);
|
|
17541
|
-
const schemaH = (Number(element.height) || 0) * (Number(element.scaleY) || 1);
|
|
17542
|
-
if (schemaW > 0 && schemaH > 0 && (Math.abs(schemaW - liveW) > 0.5 || Math.abs(schemaH - liveH) > 0.5)) {
|
|
17543
|
-
cropFrameSizeChanged = true;
|
|
17544
|
-
}
|
|
17545
|
-
}
|
|
17546
17504
|
const hadUrlBefore = storedImageUrl && String(storedImageUrl).trim() !== "";
|
|
17547
17505
|
if (!hasUrl && hadUrlBefore) {
|
|
17548
17506
|
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 };
|
|
@@ -17579,7 +17537,7 @@ const PageCanvas = react.forwardRef(
|
|
|
17579
17537
|
const clipShapeForReplace = element.clipShape ?? ((_g = element.style) == null ? void 0 : _g.imageFrameShape) ?? (isPreviewMode ? "rectangle" : "none");
|
|
17580
17538
|
const needCropGroupForElement = imageFitForReplace !== "fill" || clipShapeForReplace && clipShapeForReplace !== "none";
|
|
17581
17539
|
const plainImageNeedsCropGroup = hasUrl && !isCropGroup2 && existingObj instanceof fabric__namespace.FabricImage && needCropGroupForElement;
|
|
17582
|
-
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate
|
|
17540
|
+
if (hasUrl && (needsReload || isPlaceholder || plainImageNeedsCropGroup || needsCropGroupFadeUpdate)) {
|
|
17583
17541
|
if (needsReload && !isBeingTransformed && (!wasJustModified || sourceUrlChanged)) {
|
|
17584
17542
|
loadImageAsync2(element, existingObj, fc);
|
|
17585
17543
|
} else if (plainImageNeedsCropGroup) {
|
|
@@ -17699,7 +17657,6 @@ const PageCanvas = react.forwardRef(
|
|
|
17699
17657
|
ct.fit = elFit;
|
|
17700
17658
|
}
|
|
17701
17659
|
updateCoverLayout(existingObj);
|
|
17702
|
-
shrinkContainGroupToImageBounds(existingObj);
|
|
17703
17660
|
applyEdgeFadeFrameClipPath(existingObj, element, ct.frameW, ct.frameH, ct.shape || "rect", ct.rx || 0);
|
|
17704
17661
|
if (allowEditing) {
|
|
17705
17662
|
installImageResizeControlsWithSnap(existingObj);
|
|
@@ -17807,7 +17764,6 @@ const PageCanvas = react.forwardRef(
|
|
|
17807
17764
|
ctSync.alignV = element.imageAlignV ?? "middle";
|
|
17808
17765
|
ctSync.containScale = Math.max(1, Math.min(3, Number(element.containScale ?? 1)));
|
|
17809
17766
|
updateCoverLayout(existingObj);
|
|
17810
|
-
shrinkContainGroupToImageBounds(existingObj);
|
|
17811
17767
|
existingObj.dirty = true;
|
|
17812
17768
|
}
|
|
17813
17769
|
}
|
|
@@ -19774,7 +19730,6 @@ const PageCanvas = react.forwardRef(
|
|
|
19774
19730
|
updateCoverLayout(cropGroup);
|
|
19775
19731
|
}
|
|
19776
19732
|
applyEdgeFadeFrameClipPath(cropGroup, element, frameW, frameH, shape, rxRatio);
|
|
19777
|
-
shrinkContainGroupToImageBounds(cropGroup);
|
|
19778
19733
|
setObjectData(cropGroup, element.id);
|
|
19779
19734
|
cropGroup.__imageElement = cropImg;
|
|
19780
19735
|
cropGroup.__imageSrc = imageUrl;
|
|
@@ -26358,9 +26313,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26358
26313
|
}
|
|
26359
26314
|
return svgString;
|
|
26360
26315
|
}
|
|
26361
|
-
const resolvedPackageVersion = "0.5.
|
|
26316
|
+
const resolvedPackageVersion = "0.5.467";
|
|
26362
26317
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26363
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26318
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.467";
|
|
26364
26319
|
const roundParityValue = (value) => {
|
|
26365
26320
|
if (typeof value !== "number") return value;
|
|
26366
26321
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27174,7 +27129,7 @@ class PixldocsRenderer {
|
|
|
27174
27129
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27175
27130
|
}
|
|
27176
27131
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27177
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27132
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-CYxG1Qy-.cjs"));
|
|
27178
27133
|
const prepared = preparePagesForExport(
|
|
27179
27134
|
cloned.pages,
|
|
27180
27135
|
canvasWidth,
|
|
@@ -29494,7 +29449,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29494
29449
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29495
29450
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29496
29451
|
try {
|
|
29497
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29452
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-CYxG1Qy-.cjs"));
|
|
29498
29453
|
try {
|
|
29499
29454
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29500
29455
|
} catch {
|
|
@@ -29808,4 +29763,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29808
29763
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29809
29764
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29810
29765
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29811
|
-
//# sourceMappingURL=index-
|
|
29766
|
+
//# sourceMappingURL=index-JJbf0DOF.cjs.map
|