@pixldocs/canvas-renderer 0.5.391 → 0.5.392
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-C5CC51On.cjs → index-B0qSXTeJ.cjs} +44 -8
- package/dist/index-B0qSXTeJ.cjs.map +1 -0
- package/dist/{index-Cx-Z8HWW.js → index-BMosbEqF.js} +44 -8
- package/dist/index-BMosbEqF.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{vectorPdfExport-C8_CSDHY.js → vectorPdfExport-CRmMt10E.js} +4 -4
- package/dist/{vectorPdfExport-C8_CSDHY.js.map → vectorPdfExport-CRmMt10E.js.map} +1 -1
- package/dist/{vectorPdfExport-B8BF2GBZ.cjs → vectorPdfExport-DhWvQzRg.cjs} +4 -4
- package/dist/{vectorPdfExport-B8BF2GBZ.cjs.map → vectorPdfExport-DhWvQzRg.cjs.map} +1 -1
- package/package.json +1 -1
- package/dist/index-C5CC51On.cjs.map +0 -1
- package/dist/index-Cx-Z8HWW.js.map +0 -1
|
@@ -11473,17 +11473,53 @@ function applyWarpAwareSelectionBorders(selection) {
|
|
|
11473
11473
|
k.calcOwnMatrix()
|
|
11474
11474
|
));
|
|
11475
11475
|
const worldAngles = worldMatrices.map((m) => norm(fabric__namespace.util.qrDecompose(m).angle ?? 0));
|
|
11476
|
+
const worldPoints = [];
|
|
11477
|
+
for (const k of kids) {
|
|
11478
|
+
try {
|
|
11479
|
+
k.setCoords();
|
|
11480
|
+
} catch {
|
|
11481
|
+
}
|
|
11482
|
+
const coords = typeof k.getCoords === "function" ? k.getCoords() : null;
|
|
11483
|
+
if (Array.isArray(coords) && coords.length) {
|
|
11484
|
+
worldPoints.push(...coords.map((p) => ({ x: p.x, y: p.y })));
|
|
11485
|
+
continue;
|
|
11486
|
+
}
|
|
11487
|
+
const aC = k.aCoords;
|
|
11488
|
+
if (aC) {
|
|
11489
|
+
for (const key of ["tl", "tr", "br", "bl"]) {
|
|
11490
|
+
const p = aC[key];
|
|
11491
|
+
if (p) worldPoints.push({ x: p.x, y: p.y });
|
|
11492
|
+
}
|
|
11493
|
+
}
|
|
11494
|
+
}
|
|
11495
|
+
const orientedAreaForAngle = (angle) => {
|
|
11496
|
+
if (worldPoints.length === 0) return Number.POSITIVE_INFINITY;
|
|
11497
|
+
const rad = -angle * Math.PI / 180;
|
|
11498
|
+
const cos = Math.cos(rad), sin = Math.sin(rad);
|
|
11499
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
11500
|
+
for (const p of worldPoints) {
|
|
11501
|
+
const xr = p.x * cos - p.y * sin;
|
|
11502
|
+
const yr = p.x * sin + p.y * cos;
|
|
11503
|
+
minX = Math.min(minX, xr);
|
|
11504
|
+
minY = Math.min(minY, yr);
|
|
11505
|
+
maxX = Math.max(maxX, xr);
|
|
11506
|
+
maxY = Math.max(maxY, yr);
|
|
11507
|
+
}
|
|
11508
|
+
return Math.max(1, (maxX - minX) * (maxY - minY));
|
|
11509
|
+
};
|
|
11476
11510
|
const ALL_SAME_TOL_DEG = 2;
|
|
11477
11511
|
const buckets = [];
|
|
11478
11512
|
for (const a of worldAngles) {
|
|
11479
11513
|
const b = buckets.find((x) => angleDelta(x.angle, a) <= ALL_SAME_TOL_DEG);
|
|
11480
11514
|
if (b) b.count++;
|
|
11481
|
-
else buckets.push({ angle: a, count: 1 });
|
|
11515
|
+
else buckets.push({ angle: a, count: 1, area: Number.POSITIVE_INFINITY });
|
|
11482
11516
|
}
|
|
11483
|
-
|
|
11517
|
+
for (const b of buckets) b.area = orientedAreaForAngle(b.angle);
|
|
11518
|
+
buckets.sort((a, b) => b.count - a.count || a.area - b.area || Math.abs(b.angle) - Math.abs(a.angle));
|
|
11484
11519
|
const dominant = buckets[0];
|
|
11485
11520
|
let targetAngle = null;
|
|
11486
|
-
|
|
11521
|
+
const isLogicalGroupSelection = !!selection.__pixldocsGroupSelection;
|
|
11522
|
+
if (dominant && Math.abs(dominant.angle) > 0.5 && (isLogicalGroupSelection || kids.length === 1 || dominant.count >= 2 || dominant.count === kids.length)) {
|
|
11487
11523
|
targetAngle = dominant.angle;
|
|
11488
11524
|
}
|
|
11489
11525
|
if (targetAngle != null) {
|
|
@@ -25048,9 +25084,9 @@ function captureFabricCanvasSvgForPdf(fabricInstance, canvasWidth, canvasHeight)
|
|
|
25048
25084
|
}
|
|
25049
25085
|
return svgString;
|
|
25050
25086
|
}
|
|
25051
|
-
const resolvedPackageVersion = "0.5.
|
|
25087
|
+
const resolvedPackageVersion = "0.5.392";
|
|
25052
25088
|
const PACKAGE_VERSION = resolvedPackageVersion;
|
|
25053
|
-
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.
|
|
25089
|
+
const DEPLOYMENT_VERSION_MARKER = "__PIXLDOCS_CANVAS_RENDERER_VERSION__:0.5.392";
|
|
25054
25090
|
const roundParityValue = (value) => {
|
|
25055
25091
|
if (typeof value !== "number") return value;
|
|
25056
25092
|
return Number.isFinite(value) ? Number(value.toFixed(3)) : value;
|
|
@@ -25864,7 +25900,7 @@ class PixldocsRenderer {
|
|
|
25864
25900
|
await this.waitForCanvasScene(container, cloned, i);
|
|
25865
25901
|
}
|
|
25866
25902
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
25867
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
25903
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DhWvQzRg.cjs"));
|
|
25868
25904
|
const prepared = preparePagesForExport(
|
|
25869
25905
|
cloned.pages,
|
|
25870
25906
|
canvasWidth,
|
|
@@ -28184,7 +28220,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
28184
28220
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
28185
28221
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
28186
28222
|
try {
|
|
28187
|
-
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
28223
|
+
const { bakeTextAnchorPositionsFromLiveSvg, logTextMeasurementDiagnostic } = await Promise.resolve().then(() => require("./vectorPdfExport-DhWvQzRg.cjs"));
|
|
28188
28224
|
try {
|
|
28189
28225
|
await logTextMeasurementDiagnostic(svgToDraw);
|
|
28190
28226
|
} catch {
|
|
@@ -28581,4 +28617,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
28581
28617
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
28582
28618
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
28583
28619
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
28584
|
-
//# sourceMappingURL=index-
|
|
28620
|
+
//# sourceMappingURL=index-B0qSXTeJ.cjs.map
|