Refine responsive connector curves
Browse files- index.html +2 -2
index.html
CHANGED
|
@@ -616,11 +616,11 @@
|
|
| 616 |
let d;
|
| 617 |
if (Math.abs(dx) > Math.abs(dy)) {
|
| 618 |
const direction = Math.sign(dx) || 1;
|
| 619 |
-
const bend = Math.max(
|
| 620 |
d = `M ${start.x} ${start.y} C ${start.x + direction * bend} ${start.y}, ${end.x - direction * bend} ${end.y}, ${end.x} ${end.y}`;
|
| 621 |
} else {
|
| 622 |
const direction = Math.sign(dy) || 1;
|
| 623 |
-
const bend = Math.max(
|
| 624 |
d = `M ${start.x} ${start.y} C ${start.x} ${start.y + direction * bend}, ${end.x} ${end.y - direction * bend}, ${end.x} ${end.y}`;
|
| 625 |
}
|
| 626 |
path.setAttribute("d", d);
|
|
|
|
| 616 |
let d;
|
| 617 |
if (Math.abs(dx) > Math.abs(dy)) {
|
| 618 |
const direction = Math.sign(dx) || 1;
|
| 619 |
+
const bend = Math.min(Math.max(16, Math.abs(dx) * 0.42), Math.abs(dx) / 2);
|
| 620 |
d = `M ${start.x} ${start.y} C ${start.x + direction * bend} ${start.y}, ${end.x - direction * bend} ${end.y}, ${end.x} ${end.y}`;
|
| 621 |
} else {
|
| 622 |
const direction = Math.sign(dy) || 1;
|
| 623 |
+
const bend = Math.min(Math.max(16, Math.abs(dy) * 0.42), Math.abs(dy) / 2);
|
| 624 |
d = `M ${start.x} ${start.y} C ${start.x} ${start.y + direction * bend}, ${end.x} ${end.y - direction * bend}, ${end.x} ${end.y}`;
|
| 625 |
}
|
| 626 |
path.setAttribute("d", d);
|