LODState class

Reactive Level of Detail (LOD) state that computes current visibility settings based on the viewport zoom level.

This class provides MobX-reactive access to LOD state, automatically updating when the viewport zoom changes. Use this in widgets to conditionally render elements based on zoom level.

The state is computed using MobX Computed values, which are cached and only recalculated when dependencies change. This ensures efficient reactivity without unnecessary recalculations.

Example:

// In a widget build method
return Observer(builder: (_) {
  final visibility = controller.lodState.currentVisibility;

  if (!visibility.showConnectionLines) {
    return const SizedBox.shrink();
  }

  return ConnectionsLayer(...);
});

Constructors

LODState({required NodeFlowConfig config, required Observable<GraphViewport> viewport})
Creates an LOD state that reacts to viewport and configuration changes.

Properties

currentVisibility DetailVisibility
The current visibility configuration based on zoom level.
no setter
hashCode int
The hash code for this object.
no setterinherited
lodConfig LODConfig
The LOD configuration containing thresholds and visibility presets.
no setter
normalizedZoom double
The current zoom value normalized to a 0.0-1.0 range.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showConnectionEndpoints bool
Whether connection endpoints should be visible at the current zoom level.
no setter
showConnectionLabels bool
Whether connection labels should be visible at the current zoom level.
no setter
showConnectionLines bool
Whether connection lines should be visible at the current zoom level.
no setter
showNodeContent bool
Whether node content should be visible at the current zoom level.
no setter
showPortLabels bool
Whether port labels should be visible at the current zoom level.
no setter
showPorts bool
Whether port shapes should be visible at the current zoom level.
no setter
showResizeHandles bool
Whether resize handles should be visible at the current zoom level.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
updateConfig(LODConfig newConfig) → void
Updates the LOD configuration at runtime.

Operators

operator ==(Object other) bool
The equality operator.
inherited