Improve map editing interactions

This commit is contained in:
FlatHack
2026-06-18 11:46:16 +02:00
parent a5f686510f
commit d2e5bd72ae
2 changed files with 127 additions and 19 deletions
+16 -1
View File
@@ -65,6 +65,7 @@ test("editor UI exposes creation, deletion, linking, notes, and background contr
assert.match(html, /id="deleteSelected"/, "missing delete action");
assert.match(html, /id="systemNote"/, "missing per-system note field");
assert.match(html, /id="backgroundColor"/, "missing configurable background");
assert.match(html, /id="systemColor"/, "missing per-system color control");
assert.match(html, /id="saveRemote"/, "missing persistent save action");
assert.match(html, /id="loadRemote"/, "missing persistent load action");
assert.doesNotMatch(html, /id="snapToGrid"/, "grid snapping must not be optional");
@@ -77,12 +78,26 @@ test("editor UI exposes creation, deletion, linking, notes, and background contr
});
test("system dragging has a forgiving hit target and stable pointer handlers", () => {
assert.match(html, /class", "system-hit"/, "missing large system drag hit target");
assert.match(html, /createElementNS\("http:\/\/www\.w3\.org\/2000\/svg", "circle"\)[\s\S]*?class", "system-hit"/, "missing circular system drag hit target");
assert.doesNotMatch(html, /createElementNS\("http:\/\/www\.w3\.org\/2000\/svg", "rect"\)[\s\S]*?class", "system-hit"/, "system labels must not be covered by click hit rects");
assert.match(html, /function stopLabelEvent/, "missing label event blocker");
assert.match(html, /label\.addEventListener\("click", stopLabelEvent\)/, "labels should swallow clicks without selecting objects");
assert.match(html, /function handleDragMove/, "missing shared drag move handler");
assert.match(html, /window\.addEventListener\("pointermove", handleDragMove\)/, "missing window pointermove handler");
assert.match(html, /window\.addEventListener\("pointerup", handleDragEnd\)/, "missing window pointerup handler");
});
test("map supports zoom and easier connection selection", () => {
assert.match(html, /id="zoomIn"/, "missing zoom-in action");
assert.match(html, /id="zoomOut"/, "missing zoom-out action");
assert.match(html, /id="resetZoom"/, "missing reset zoom action");
assert.match(html, /function zoomMap/, "missing zoom behavior");
assert.match(html, /svg\.addEventListener\("wheel"/, "missing wheel zoom");
assert.match(html, /<g id="connections"><\/g>\s*<g id="connectionHits"><\/g>/, "connection hit layer should sit above visible lines");
assert.match(html, /\.connection\s*\{[\s\S]*?pointer-events:\s*none;/, "visible connections should not block hit lines");
assert.match(html, /\.connection-hit\s*\{[\s\S]*?stroke-width:\s*28;/, "connection hit target should be wide");
});
test("start script launches the local server and opens the browser", () => {
assert.match(startScript, /node.*server\.mjs/i, "start script must launch server.mjs with node");
assert.match(startScript, /127\.0\.0\.1:3000/i, "start script must open the local app URL");