Map: a Lines setting for curved or right-angled connections
Both map views can draw their lines as right-angled runs with rounded corners instead of curves; the choice is remembered per browser. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
939ebf8d83
commit
2986734196
7 files changed
+191
-5
No files matched your search
@@ -9,6 +9,8 @@ import { PageSkeleton } from "../components/Skeleton";
|
||||
import { readableError } from "../utils/errors";
|
||||
import PageIntro from "../components/PageIntro";
|
||||
import { t } from "../i18n";
|
||||
import MapLinesToggle, { useMapLineStyle } from "../components/MapLinesToggle";
|
||||
import { edgePath } from "../utils/mapLines";
|
||||
|
||||
const NODE_W = 210;
|
||||
const NODE_H = 46;
|
||||
@@ -130,6 +132,7 @@ export default function MapPage({ user }: { user: CurrentUser }) {
|
||||
}
|
||||
|
||||
function ConnectionsMap() {
|
||||
const [lineStyle] = useMapLineStyle();
|
||||
const [data, setData] = useState<MapData | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [focus, setFocus] = useState<string | null>(null);
|
||||
@@ -169,6 +172,7 @@ function ConnectionsMap() {
|
||||
{data && drawing && data.nodes.length > 0 && (
|
||||
<div className="card">
|
||||
<div className="card-body map-scroll">
|
||||
<MapLinesToggle />
|
||||
<div className="map-columns" style={{ width: drawing.width }}>
|
||||
{drawing.columns.map((c) => (
|
||||
<div key={c.title} className="map-column-title" style={{ left: c.x, width: NODE_W }}>
|
||||
@@ -188,9 +192,8 @@ function ConnectionsMap() {
|
||||
const y1 = l.y + NODE_H / 2;
|
||||
const x2 = r.x;
|
||||
const y2 = r.y + NODE_H / 2;
|
||||
const mid = (x1 + x2) / 2;
|
||||
const active = !lit || (lit.has(e.from) && lit.has(e.to) && (e.from === focus || e.to === focus));
|
||||
return <path key={`${e.from}>${e.to}`} d={`M${x1},${y1} C${mid},${y1} ${mid},${y2} ${x2},${y2}`} className={active ? "map-edge" : "map-edge map-dim"} fill="none" />;
|
||||
return <path key={`${e.from}>${e.to}`} d={edgePath(x1, y1, x2, y2, lineStyle)} className={active ? "map-edge" : "map-edge map-dim"} fill="none" />;
|
||||
})}
|
||||
</svg>
|
||||
{[...drawing.placed.values()].map((n) => {
|
||||
|
||||
Reference in new issue
Block a user