优化布局

This commit is contained in:
CN-JS-HuiBai
2026-04-06 01:32:49 +08:00
parent 98fdeca33b
commit d7b6d3aebb

View File

@@ -803,14 +803,16 @@
const pts = [start, end].slice().sort((a, b) => a[0] - b[0] || a[1] - b[1]);
const isForward = (start === pts[0]);
// Calculate curveness spread
// Calculate curveness: ensure all lines are slightly curved
let finalCurve = 0;
if (count > 1) {
// Spread curveness between -0.3 and 0.3
const maxSpread = 0.3;
const spread = (i - (count - 1) / 2) * (maxSpread * 2 / Math.max(1, count - 1));
// Adjust sign based on direction so same "slot" arches same way in absolute terms
// A->B with curve C and B->A with curve -C arch to the same side of the AB chord
if (count === 1) {
finalCurve = 0.15; // Default slight curve for single lines
} else {
// Spread overlapping lines: 0.15, -0.15, 0.3, -0.3...
// This creates an "eye" or "fan" effect where no line is straight
const magnitude = 0.15 + Math.floor(i / 2) * 0.15;
const spread = (i % 2 === 0) ? magnitude : -magnitude;
// Adjust sign based on direction so they occupy unique visual slots
finalCurve = isForward ? spread : -spread;
}