Merge lh-graph refinement wave (feat/edge-glyph @ 66e6212) into main
Edge glyph (⟹ follows arrow) WITHDRAWN by owner after two live-rejected variants — CanvasEdge.type plumbing + ArrowGeom retained, differentiation approach still open (docs/vision-edge-glyph.md decision record). Keepers: regions.enabled "Background colors" compute off-switch (skips splat/blur/readback/blit), clusterLabelSize (default 14, topmost draw layer, screen-px) with Cluster labels toggle + size slider in the Regions section, dependency graying across the settings panels, physics panel reorder (general forces first, Depth anchor + conditionals last). Merged cleanly over master's coverage-chrome changes in graph-view.tsx (their gated fragment + the ungated GraphCoverageControl coexist); data/ scratch not carried (untracked, master's real render-settings.json picked up clusterLabelSize=14 via sanitizer fallback). Gates 488/488; live- verified: chrome intact, Background colors graying works, physics order, coverage panel opens (11 sessions).
This commit is contained in:
@@ -113,6 +113,7 @@ describe("arrowGeometry", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("pickNearest (distance-check picking)", () => {
|
||||
const nodes = [
|
||||
{ id: "a", x: 10, y: 10 },
|
||||
@@ -225,3 +226,4 @@ describe("sanitizePhysicsTuning (physics controls)", () => {
|
||||
assert.equal(t.velocityDecay, 0.9);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { describe, it as test } from "node:test";
|
||||
import {
|
||||
ARROW_LENGTH_RANGE,
|
||||
CHARGE_RANGE,
|
||||
CLUSTER_LABEL_SIZE_RANGE,
|
||||
CLUSTER_PULL_RANGE,
|
||||
DEFAULT_RENDER_SETTINGS,
|
||||
DEPTH_BASE_RADIUS_RANGE,
|
||||
@@ -53,6 +54,7 @@ describe("sanitizeRenderSettings", () => {
|
||||
assert.equal(s.labelSize, DEFAULT_RENDER_SETTINGS.labelSize);
|
||||
assert.equal(s.labelZoom, DEFAULT_RENDER_SETTINGS.labelZoom);
|
||||
assert.equal(s.clusterLabels, DEFAULT_RENDER_SETTINGS.clusterLabels);
|
||||
assert.equal(s.clusterLabelSize, DEFAULT_RENDER_SETTINGS.clusterLabelSize); // old files → 14
|
||||
});
|
||||
|
||||
test("out-of-range values clamp; wrong types reset", () => {
|
||||
@@ -63,6 +65,7 @@ describe("sanitizeRenderSettings", () => {
|
||||
labelZoom: 100,
|
||||
labelSize: "big" as unknown as number,
|
||||
clusterLabels: "yes" as unknown as boolean,
|
||||
clusterLabelSize: "huge" as unknown as number,
|
||||
});
|
||||
assert.equal(s.nodeSize, NODE_SIZE_RANGE.max); // clamped to max
|
||||
assert.equal(s.edgeWidth, EDGE_WIDTH_RANGE.min); // clamped to min
|
||||
@@ -70,6 +73,19 @@ describe("sanitizeRenderSettings", () => {
|
||||
assert.equal(s.labelZoom, LABEL_ZOOM_MAX);
|
||||
assert.equal(s.labelSize, DEFAULT_RENDER_SETTINGS.labelSize); // NaN-safe reset
|
||||
assert.equal(s.clusterLabels, DEFAULT_RENDER_SETTINGS.clusterLabels);
|
||||
assert.equal(s.clusterLabelSize, DEFAULT_RENDER_SETTINGS.clusterLabelSize); // NaN-safe reset
|
||||
});
|
||||
|
||||
test("clusterLabelSize clamps to its own range (slider law)", () => {
|
||||
// Default 14 is the geometric mean of [7, 28] → dead-center slider.
|
||||
assert.equal(
|
||||
Math.sqrt(CLUSTER_LABEL_SIZE_RANGE.min * CLUSTER_LABEL_SIZE_RANGE.max),
|
||||
DEFAULT_RENDER_SETTINGS.clusterLabelSize,
|
||||
);
|
||||
const s = sanitizeRenderSettings({ clusterLabelSize: 999 });
|
||||
assert.equal(s.clusterLabelSize, CLUSTER_LABEL_SIZE_RANGE.max);
|
||||
const s2 = sanitizeRenderSettings({ clusterLabelSize: 1 });
|
||||
assert.equal(s2.clusterLabelSize, CLUSTER_LABEL_SIZE_RANGE.min);
|
||||
});
|
||||
|
||||
test("the low ends accept small sizes (log-slider floors)", () => {
|
||||
@@ -88,6 +104,7 @@ describe("sanitizeRenderSettings", () => {
|
||||
labelZoom: 0.25,
|
||||
labelSize: 4,
|
||||
clusterLabels: false,
|
||||
clusterLabelSize: 20,
|
||||
regions: DEFAULT_REGION_TUNING,
|
||||
physics: DEFAULT_PHYSICS_TUNING,
|
||||
};
|
||||
@@ -214,4 +231,16 @@ describe("slider mapping (log scale, default-centered)", () => {
|
||||
// Stored blur 0 (the old off zone) snaps back into the set.
|
||||
assert.equal(sanitizeRegionTuning({ blur: 0 }).blur, 2);
|
||||
});
|
||||
|
||||
test("enabled is the compute off switch: only an explicit false turns it off", () => {
|
||||
// Default on; old persisted files predate the field (missing → on);
|
||||
// garbage falls back to on (fail toward the tuned look).
|
||||
assert.equal(DEFAULT_REGION_TUNING.enabled, true);
|
||||
assert.equal(sanitizeRegionTuning({}).enabled, true);
|
||||
assert.equal(sanitizeRegionTuning({ enabled: false }).enabled, false);
|
||||
assert.equal(sanitizeRegionTuning({ enabled: true }).enabled, true);
|
||||
assert.equal(sanitizeRegionTuning({ enabled: "no" as unknown as boolean }).enabled, true);
|
||||
// An explicit false survives even alongside garbage in other fields.
|
||||
assert.equal(sanitizeRegionTuning({ enabled: false, blur: 99, bitmap: 99999 }).enabled, false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user