@pixldocs/canvas-renderer 0.5.483 → 0.5.485
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-CtxAf4Gq.js → index-BPh2zj_A.js} +47 -20
- package/dist/index-BPh2zj_A.js.map +1 -0
- package/dist/{index-Cb2oeGs6.cjs → index-DG8BpcY2.cjs} +47 -20
- package/dist/index-DG8BpcY2.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-Y9h0HpBX.js → vectorPdfExport-BaxoJICy.js} +4 -4
- package/dist/{vectorPdfExport-Y9h0HpBX.js.map → vectorPdfExport-BaxoJICy.js.map} +1 -1
- package/dist/{vectorPdfExport-D7rfsr1y.cjs → vectorPdfExport-pylbB5Ls.cjs} +4 -4
- package/dist/{vectorPdfExport-D7rfsr1y.cjs.map → vectorPdfExport-pylbB5Ls.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Cb2oeGs6.cjs.map +0 -1
- package/dist/index-CtxAf4Gq.js.map +0 -1
|
@@ -786,6 +786,9 @@ function simpleWidth(node) {
|
|
|
786
786
|
function simpleHeight(node) {
|
|
787
787
|
if (isElement(node)) {
|
|
788
788
|
const el = node;
|
|
789
|
+
if (el.type === "line") {
|
|
790
|
+
return Math.max(1, Number(el.strokeWidth) || Number(el.height) || 1);
|
|
791
|
+
}
|
|
789
792
|
const h = el.height;
|
|
790
793
|
if (typeof h === "number") return h;
|
|
791
794
|
if (el.type === "text" && el.text) {
|
|
@@ -10075,12 +10078,28 @@ function createText(element) {
|
|
|
10075
10078
|
applyTextShadow(textbox, element);
|
|
10076
10079
|
return textbox;
|
|
10077
10080
|
}
|
|
10081
|
+
function getLineVisualGeometry(element) {
|
|
10082
|
+
const visualWidth = Math.max(1, Number(element.width) * (element.scaleX ?? 1) || 100);
|
|
10083
|
+
const strokeWidth = Math.max(0, Number(element.strokeWidth) || 2);
|
|
10084
|
+
const capInset = Math.min(visualWidth / 2, strokeWidth / 2);
|
|
10085
|
+
return {
|
|
10086
|
+
x1: capInset,
|
|
10087
|
+
y1: 0,
|
|
10088
|
+
x2: Math.max(capInset, visualWidth - capInset),
|
|
10089
|
+
y2: 0,
|
|
10090
|
+
visualWidth,
|
|
10091
|
+
strokeWidth
|
|
10092
|
+
};
|
|
10093
|
+
}
|
|
10078
10094
|
function createLine(element) {
|
|
10079
|
-
const
|
|
10080
|
-
return new fabric.Line([
|
|
10095
|
+
const g = getLineVisualGeometry(element);
|
|
10096
|
+
return new fabric.Line([g.x1, g.y1, g.x2, g.y2], {
|
|
10081
10097
|
stroke: element.stroke || "#1a1a1a",
|
|
10082
|
-
strokeWidth:
|
|
10098
|
+
strokeWidth: g.strokeWidth,
|
|
10083
10099
|
strokeDashArray: element.strokeDashArray,
|
|
10100
|
+
strokeLineCap: "round",
|
|
10101
|
+
strokeLineJoin: "round",
|
|
10102
|
+
strokeUniform: true,
|
|
10084
10103
|
scaleX: 1,
|
|
10085
10104
|
scaleY: 1
|
|
10086
10105
|
});
|
|
@@ -16157,9 +16176,10 @@ const PageCanvas = forwardRef(
|
|
|
16157
16176
|
} else if (obj instanceof fabric.Line) {
|
|
16158
16177
|
const x1 = obj.x1 ?? 0, y1 = obj.y1 ?? 0, x2 = obj.x2 ?? 0, y2 = obj.y2 ?? 0;
|
|
16159
16178
|
const rawLen = Math.hypot(x2 - x1, y2 - y1);
|
|
16179
|
+
const sw = Math.max(0, Number(obj.strokeWidth ?? (sourceElement == null ? void 0 : sourceElement.strokeWidth) ?? 0) || 0);
|
|
16160
16180
|
const ownScaleX = obj.scaleX ?? 1;
|
|
16161
16181
|
const selScaleX = isActiveSelection && activeObj ? Math.abs(activeObj.scaleX ?? 1) : 1;
|
|
16162
|
-
intrinsicWidth = rawLen * Math.abs(ownScaleX) * selScaleX;
|
|
16182
|
+
intrinsicWidth = rawLen * Math.abs(ownScaleX) * selScaleX + sw;
|
|
16163
16183
|
intrinsicHeight = 0;
|
|
16164
16184
|
} else {
|
|
16165
16185
|
intrinsicWidth = obj.width ?? 0;
|
|
@@ -18805,23 +18825,21 @@ const PageCanvas = forwardRef(
|
|
|
18805
18825
|
const baseScaleY = isImage && element.imageFit === "fill" ? rH / ((obj.height ?? 1) || 1) : 1;
|
|
18806
18826
|
const isLine = obj instanceof fabric.Line;
|
|
18807
18827
|
if (isLine) {
|
|
18808
|
-
const
|
|
18809
|
-
|
|
18810
|
-
x1:
|
|
18811
|
-
y1:
|
|
18812
|
-
x2:
|
|
18813
|
-
y2:
|
|
18828
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
18829
|
+
obj.set({
|
|
18830
|
+
x1: lineGeometry.x1,
|
|
18831
|
+
y1: lineGeometry.y1,
|
|
18832
|
+
x2: lineGeometry.x2,
|
|
18833
|
+
y2: lineGeometry.y2,
|
|
18814
18834
|
angle: element.angle ?? 0,
|
|
18815
18835
|
scaleX: 1,
|
|
18816
18836
|
scaleY: 1,
|
|
18817
18837
|
skewX: 0,
|
|
18818
18838
|
skewY: 0
|
|
18819
|
-
};
|
|
18839
|
+
});
|
|
18820
18840
|
if (!skipPositionUpdate) {
|
|
18821
|
-
|
|
18822
|
-
lineSet.top = fabricPos.top;
|
|
18841
|
+
obj.set({ left: fabricPos.left, top: fabricPos.top });
|
|
18823
18842
|
}
|
|
18824
|
-
obj.set(lineSet);
|
|
18825
18843
|
obj.setCoords();
|
|
18826
18844
|
}
|
|
18827
18845
|
if (!isLine) {
|
|
@@ -19329,14 +19347,23 @@ const PageCanvas = forwardRef(
|
|
|
19329
19347
|
if (fcShape) fcShape.renderAll();
|
|
19330
19348
|
}
|
|
19331
19349
|
if (isLine) {
|
|
19350
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
19351
|
+
const prevLeft = obj.left;
|
|
19352
|
+
const prevTop = obj.top;
|
|
19332
19353
|
obj.set({
|
|
19354
|
+
x1: lineGeometry.x1,
|
|
19355
|
+
y1: lineGeometry.y1,
|
|
19356
|
+
x2: lineGeometry.x2,
|
|
19357
|
+
y2: lineGeometry.y2,
|
|
19333
19358
|
stroke: element.stroke || "#1a1a1a",
|
|
19334
|
-
strokeWidth:
|
|
19359
|
+
strokeWidth: lineGeometry.strokeWidth,
|
|
19335
19360
|
strokeUniform: true,
|
|
19336
19361
|
strokeLineCap: "round",
|
|
19337
19362
|
strokeLineJoin: "round",
|
|
19338
19363
|
...element.strokeDashArray && { strokeDashArray: element.strokeDashArray }
|
|
19339
19364
|
});
|
|
19365
|
+
obj.set({ left: prevLeft, top: prevTop });
|
|
19366
|
+
obj.setCoords();
|
|
19340
19367
|
}
|
|
19341
19368
|
if (element.fillGradient && isGradientConfig(element.fillGradient)) {
|
|
19342
19369
|
const objWidth = typeof obj.width === "number" ? obj.width : rW;
|
|
@@ -26375,9 +26402,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26375
26402
|
}
|
|
26376
26403
|
return svgString;
|
|
26377
26404
|
}
|
|
26378
|
-
const resolvedPackageVersion = "0.5.
|
|
26405
|
+
const resolvedPackageVersion = "0.5.485";
|
|
26379
26406
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26380
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26407
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.485";
|
|
26381
26408
|
const roundParityValue = (value) => {
|
|
26382
26409
|
if (typeof value !== "number") return value;
|
|
26383
26410
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27191,7 +27218,7 @@ class PixldocsRenderer {
|
|
|
27191
27218
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27192
27219
|
}
|
|
27193
27220
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27194
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27221
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BaxoJICy.js");
|
|
27195
27222
|
const prepared = preparePagesForExport(
|
|
27196
27223
|
cloned.pages,
|
|
27197
27224
|
canvasWidth,
|
|
@@ -29511,7 +29538,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29511
29538
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29512
29539
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29513
29540
|
try {
|
|
29514
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29541
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-BaxoJICy.js");
|
|
29515
29542
|
try {
|
|
29516
29543
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29517
29544
|
} catch {
|
|
@@ -29828,4 +29855,4 @@ export {
|
|
|
29828
29855
|
buildTeaserBlurFlatKeys as y,
|
|
29829
29856
|
collectFontDescriptorsFromConfig as z
|
|
29830
29857
|
};
|
|
29831
|
-
//# sourceMappingURL=index-
|
|
29858
|
+
//# sourceMappingURL=index-BPh2zj_A.js.map
|