@pixldocs/canvas-renderer 0.5.482 → 0.5.484
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-D3HaA3of.cjs → index-BtWgeifE.cjs} +41 -16
- package/dist/index-BtWgeifE.cjs.map +1 -0
- package/dist/{index-OZhXWoy2.js → index-Dl4edGXt.js} +41 -16
- package/dist/index-Dl4edGXt.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-VJIOnRbU.cjs → vectorPdfExport-B811hVqY.cjs} +4 -4
- package/dist/{vectorPdfExport-VJIOnRbU.cjs.map → vectorPdfExport-B811hVqY.cjs.map} +1 -1
- package/dist/{vectorPdfExport-BnwNy_o1.js → vectorPdfExport-C02bLwpw.js} +4 -4
- package/dist/{vectorPdfExport-BnwNy_o1.js.map → vectorPdfExport-C02bLwpw.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-D3HaA3of.cjs.map +0 -1
- package/dist/index-OZhXWoy2.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
|
});
|
|
@@ -10145,7 +10164,7 @@ function createFabricObject(element) {
|
|
|
10145
10164
|
mtr: true
|
|
10146
10165
|
});
|
|
10147
10166
|
obj.set({
|
|
10148
|
-
padding:
|
|
10167
|
+
padding: 0,
|
|
10149
10168
|
perPixelTargetFind: false
|
|
10150
10169
|
});
|
|
10151
10170
|
}
|
|
@@ -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,12 +18825,12 @@ 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
|
|
18828
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
18809
18829
|
const lineSet = {
|
|
18810
|
-
x1:
|
|
18811
|
-
y1:
|
|
18812
|
-
x2:
|
|
18813
|
-
y2:
|
|
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,
|
|
@@ -19329,9 +19349,14 @@ const PageCanvas = forwardRef(
|
|
|
19329
19349
|
if (fcShape) fcShape.renderAll();
|
|
19330
19350
|
}
|
|
19331
19351
|
if (isLine) {
|
|
19352
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
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",
|
|
@@ -26375,9 +26400,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26375
26400
|
}
|
|
26376
26401
|
return svgString;
|
|
26377
26402
|
}
|
|
26378
|
-
const resolvedPackageVersion = "0.5.
|
|
26403
|
+
const resolvedPackageVersion = "0.5.484";
|
|
26379
26404
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26380
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26405
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.484";
|
|
26381
26406
|
const roundParityValue = (value) => {
|
|
26382
26407
|
if (typeof value !== "number") return value;
|
|
26383
26408
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27191,7 +27216,7 @@ class PixldocsRenderer {
|
|
|
27191
27216
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27192
27217
|
}
|
|
27193
27218
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27194
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
27219
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-C02bLwpw.js");
|
|
27195
27220
|
const prepared = preparePagesForExport(
|
|
27196
27221
|
cloned.pages,
|
|
27197
27222
|
canvasWidth,
|
|
@@ -29511,7 +29536,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29511
29536
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29512
29537
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29513
29538
|
try {
|
|
29514
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-
|
|
29539
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await import("./vectorPdfExport-C02bLwpw.js");
|
|
29515
29540
|
try {
|
|
29516
29541
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29517
29542
|
} catch {
|
|
@@ -29828,4 +29853,4 @@ export {
|
|
|
29828
29853
|
buildTeaserBlurFlatKeys as y,
|
|
29829
29854
|
collectFontDescriptorsFromConfig as z
|
|
29830
29855
|
};
|
|
29831
|
-
//# sourceMappingURL=index-
|
|
29856
|
+
//# sourceMappingURL=index-Dl4edGXt.js.map
|