LodExtension class
Level of Detail (LOD) extension that provides reactive visibility settings based on the viewport zoom level.
This extension extends NodeFlowExtension with LODConfig and manages
its own config via an internal Observable. It computes visibility settings
using MobX Computed values that react to zoom and config changes.
Usage
Access LOD state via the controller's lod getter:
// In a widget build method
return Observer(builder: (_) {
if (!controller.lod.showConnectionLines) {
return const SizedBox.shrink();
}
return ConnectionsLayer(...);
});
Configuration
Update LOD thresholds at runtime:
controller.lod.updateConfig(LODConfig.disabled); // Always show full detail
- Inheritance
-
- Object
- NodeFlowExtension<
LODConfig> - LodExtension
Constructors
- LodExtension({LODConfig config = LODConfig.defaultConfig})
- Creates a LOD extension with optional initial configuration.
Properties
- config → LODConfig
-
The configuration for this extension.
no setteroverride
- currentVisibility → DetailVisibility
-
The current visibility configuration based on zoom level.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Unique identifier for this extension.
no setteroverride
- 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
-
attach(
NodeFlowController controller) → void -
Called when the extension is attached to a controller.
override
-
detach(
) → void -
Called when the extension is detached from the controller.
override
-
disable(
) → void - Disables LOD by setting config to LODConfig.disabled.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onEvent(
GraphEvent event) → void -
Called when a graph event occurs.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateConfig(
LODConfig newConfig) → void - Updates the LOD configuration at runtime.
-
useDefault(
) → void - Enables standard LOD behavior by setting config to LODConfig.defaultConfig.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited