Skip to content
D
Documentation

createDefaultLODConfig

reference
1 min readUpdated

Import it from @grafloria/engine.

Build the default 3-tier LOD policy.

  zoom >= 1.0        -> 'high'   (everything)
  0.5 <= zoom < 1.0  -> 'medium' (labels, borders, ports, decorations, handles,
                                  + routing, link-detail, gradients)
  zoom <  0.5        -> 'low'    (nothing — plain rects and direct lines)

THE MEDIUM/LOW BREAKPOINT MOVED, 0.2 → 0.5, and that is the behaviour change in this wave.

The old boundary made 'medium' span 0.2–1.0 with a near-full feature set, so a diagram at 0.25 zoom — the zoom fit-to-content lands on for anything large — still measured every label, drew every port, and routed every edge around every obstacle. It was the far view that was expensive: 63 SECONDS for one 10k-node frame, against 124ms for the near view. LOD had breakpoints but no economics.

Each breakpoint is now set where the DETAIL STOPS BEING LEGIBLE, not where it stops being cheap — the theme's 12px label is 6px at 0.5 zoom and 3px at 0.25, and a port glyph is under a pixel. Zooms in [0.5, 1.0) render exactly as they always have. [0.2, 0.5) is 'sketch': text and chrome go (they are unreadable), the graph's SHAPE stays (it is not). Below 0.2, everything goes.

Cost is deliberately NOT a factor in these numbers, because it cannot be: the same zoom is cheap for 30 nodes and ruinous for 10,000, and a constant chosen here would either tax the small diagram or fail to save the large one. That is the quality governor's job — it measures the frame and steps the tier down on the scenes and machines that need it. Perception picks the tier; measurement decides whether you can afford it.

Fresh Sets are created per call so no two diagrams share mutable state.

ts
function createDefaultLODConfig(): LODConfig

Was this page helpful?

createDefaultLODConfig — Grafloria