@pixldocs/canvas-renderer 0.5.483 → 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-Cb2oeGs6.cjs → index-BtWgeifE.cjs} +40 -15
- package/dist/index-BtWgeifE.cjs.map +1 -0
- package/dist/{index-CtxAf4Gq.js → index-Dl4edGXt.js} +40 -15
- package/dist/index-Dl4edGXt.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-D7rfsr1y.cjs → vectorPdfExport-B811hVqY.cjs} +4 -4
- package/dist/{vectorPdfExport-D7rfsr1y.cjs.map → vectorPdfExport-B811hVqY.cjs.map} +1 -1
- package/dist/{vectorPdfExport-Y9h0HpBX.js → vectorPdfExport-C02bLwpw.js} +4 -4
- package/dist/{vectorPdfExport-Y9h0HpBX.js.map → vectorPdfExport-C02bLwpw.js.map} +1 -1
- package/package.json +1 -1
- package/dist/index-Cb2oeGs6.cjs.map +0 -1
- package/dist/index-CtxAf4Gq.js.map +0 -1
|
@@ -804,6 +804,9 @@ function simpleWidth(node) {
|
|
|
804
804
|
function simpleHeight(node) {
|
|
805
805
|
if (isElement(node)) {
|
|
806
806
|
const el = node;
|
|
807
|
+
if (el.type === "line") {
|
|
808
|
+
return Math.max(1, Number(el.strokeWidth) || Number(el.height) || 1);
|
|
809
|
+
}
|
|
807
810
|
const h = el.height;
|
|
808
811
|
if (typeof h === "number") return h;
|
|
809
812
|
if (el.type === "text" && el.text) {
|
|
@@ -10093,12 +10096,28 @@ function createText(element) {
|
|
|
10093
10096
|
applyTextShadow(textbox, element);
|
|
10094
10097
|
return textbox;
|
|
10095
10098
|
}
|
|
10099
|
+
function getLineVisualGeometry(element) {
|
|
10100
|
+
const visualWidth = Math.max(1, Number(element.width) * (element.scaleX ?? 1) || 100);
|
|
10101
|
+
const strokeWidth = Math.max(0, Number(element.strokeWidth) || 2);
|
|
10102
|
+
const capInset = Math.min(visualWidth / 2, strokeWidth / 2);
|
|
10103
|
+
return {
|
|
10104
|
+
x1: capInset,
|
|
10105
|
+
y1: 0,
|
|
10106
|
+
x2: Math.max(capInset, visualWidth - capInset),
|
|
10107
|
+
y2: 0,
|
|
10108
|
+
visualWidth,
|
|
10109
|
+
strokeWidth
|
|
10110
|
+
};
|
|
10111
|
+
}
|
|
10096
10112
|
function createLine(element) {
|
|
10097
|
-
const
|
|
10098
|
-
return new fabric__namespace.Line([
|
|
10113
|
+
const g = getLineVisualGeometry(element);
|
|
10114
|
+
return new fabric__namespace.Line([g.x1, g.y1, g.x2, g.y2], {
|
|
10099
10115
|
stroke: element.stroke || "#1a1a1a",
|
|
10100
|
-
strokeWidth:
|
|
10116
|
+
strokeWidth: g.strokeWidth,
|
|
10101
10117
|
strokeDashArray: element.strokeDashArray,
|
|
10118
|
+
strokeLineCap: "round",
|
|
10119
|
+
strokeLineJoin: "round",
|
|
10120
|
+
strokeUniform: true,
|
|
10102
10121
|
scaleX: 1,
|
|
10103
10122
|
scaleY: 1
|
|
10104
10123
|
});
|
|
@@ -16175,9 +16194,10 @@ const PageCanvas = react.forwardRef(
|
|
|
16175
16194
|
} else if (obj instanceof fabric__namespace.Line) {
|
|
16176
16195
|
const x1 = obj.x1 ?? 0, y1 = obj.y1 ?? 0, x2 = obj.x2 ?? 0, y2 = obj.y2 ?? 0;
|
|
16177
16196
|
const rawLen = Math.hypot(x2 - x1, y2 - y1);
|
|
16197
|
+
const sw = Math.max(0, Number(obj.strokeWidth ?? (sourceElement == null ? void 0 : sourceElement.strokeWidth) ?? 0) || 0);
|
|
16178
16198
|
const ownScaleX = obj.scaleX ?? 1;
|
|
16179
16199
|
const selScaleX = isActiveSelection && activeObj ? Math.abs(activeObj.scaleX ?? 1) : 1;
|
|
16180
|
-
intrinsicWidth = rawLen * Math.abs(ownScaleX) * selScaleX;
|
|
16200
|
+
intrinsicWidth = rawLen * Math.abs(ownScaleX) * selScaleX + sw;
|
|
16181
16201
|
intrinsicHeight = 0;
|
|
16182
16202
|
} else {
|
|
16183
16203
|
intrinsicWidth = obj.width ?? 0;
|
|
@@ -18823,12 +18843,12 @@ const PageCanvas = react.forwardRef(
|
|
|
18823
18843
|
const baseScaleY = isImage && element.imageFit === "fill" ? rH / ((obj.height ?? 1) || 1) : 1;
|
|
18824
18844
|
const isLine = obj instanceof fabric__namespace.Line;
|
|
18825
18845
|
if (isLine) {
|
|
18826
|
-
const
|
|
18846
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
18827
18847
|
const lineSet = {
|
|
18828
|
-
x1:
|
|
18829
|
-
y1:
|
|
18830
|
-
x2:
|
|
18831
|
-
y2:
|
|
18848
|
+
x1: lineGeometry.x1,
|
|
18849
|
+
y1: lineGeometry.y1,
|
|
18850
|
+
x2: lineGeometry.x2,
|
|
18851
|
+
y2: lineGeometry.y2,
|
|
18832
18852
|
angle: element.angle ?? 0,
|
|
18833
18853
|
scaleX: 1,
|
|
18834
18854
|
scaleY: 1,
|
|
@@ -19347,9 +19367,14 @@ const PageCanvas = react.forwardRef(
|
|
|
19347
19367
|
if (fcShape) fcShape.renderAll();
|
|
19348
19368
|
}
|
|
19349
19369
|
if (isLine) {
|
|
19370
|
+
const lineGeometry = getLineVisualGeometry(element);
|
|
19350
19371
|
obj.set({
|
|
19372
|
+
x1: lineGeometry.x1,
|
|
19373
|
+
y1: lineGeometry.y1,
|
|
19374
|
+
x2: lineGeometry.x2,
|
|
19375
|
+
y2: lineGeometry.y2,
|
|
19351
19376
|
stroke: element.stroke || "#1a1a1a",
|
|
19352
|
-
strokeWidth:
|
|
19377
|
+
strokeWidth: lineGeometry.strokeWidth,
|
|
19353
19378
|
strokeUniform: true,
|
|
19354
19379
|
strokeLineCap: "round",
|
|
19355
19380
|
strokeLineJoin: "round",
|
|
@@ -26393,9 +26418,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
26393
26418
|
}
|
|
26394
26419
|
return svgString;
|
|
26395
26420
|
}
|
|
26396
|
-
const resolvedPackageVersion = "0.5.
|
|
26421
|
+
const resolvedPackageVersion = "0.5.484";
|
|
26397
26422
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
26398
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
26423
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.484";
|
|
26399
26424
|
const roundParityValue = (value) => {
|
|
26400
26425
|
if (typeof value !== "number") return value;
|
|
26401
26426
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -27209,7 +27234,7 @@ class PixldocsRenderer {
|
|
|
27209
27234
|
await this.waitForCanvasScene(container, cloned, i);
|
|
27210
27235
|
}
|
|
27211
27236
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
27212
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
27237
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-B811hVqY.cjs"));
|
|
27213
27238
|
const prepared = preparePagesForExport(
|
|
27214
27239
|
cloned.pages,
|
|
27215
27240
|
canvasWidth,
|
|
@@ -29529,7 +29554,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
29529
29554
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
29530
29555
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
29531
29556
|
try {
|
|
29532
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
29557
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-B811hVqY.cjs"));
|
|
29533
29558
|
try {
|
|
29534
29559
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
29535
29560
|
} catch {
|
|
@@ -29843,4 +29868,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
29843
29868
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
29844
29869
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
29845
29870
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
29846
|
-
//# sourceMappingURL=index-
|
|
29871
|
+
//# sourceMappingURL=index-BtWgeifE.cjs.map
|