step 5: complete first gauge catalogue
This commit is contained in:
@@ -9,8 +9,8 @@ from typing import Any
|
||||
|
||||
from .animation import AnimationState, start_animation
|
||||
from .exceptions import GaugeConfigError, GaugeNotFoundError
|
||||
from .gauges import GaugeConfig
|
||||
from .scales import clamp_value, validate_markers, validate_thresholds
|
||||
from .gauges import CompassGaugeConfig, GaugeConfig
|
||||
from .scales import clamp_value, compass_heading, validate_markers, validate_thresholds
|
||||
from .sizing import RequestedSize, SizeState
|
||||
from .smoothing import SmoothingState
|
||||
from .themes import GaugeTheme, get_theme
|
||||
@@ -150,6 +150,8 @@ def clamp_runtime_value(value: GaugeValue, config: GaugeConfig) -> tuple[float |
|
||||
return None, value is not None
|
||||
if not math.isfinite(numeric):
|
||||
return None, True
|
||||
if isinstance(config, CompassGaugeConfig):
|
||||
numeric = compass_heading(numeric)
|
||||
if config.clamp:
|
||||
return clamp_value(numeric, config.min_value, config.max_value), False
|
||||
return numeric, False
|
||||
|
||||
Reference in New Issue
Block a user