step 6: add animation and high rate update stress tests
This commit is contained in:
@@ -31,9 +31,16 @@ from .scales import (
|
||||
)
|
||||
from .sizing import effective_size, square_gauge_rect, update_measured_size
|
||||
from .smoothing import advance_smoothing
|
||||
from .state import DirtyFlags, GaugeState, animation_config, size_state_for_gauge, update_state_size
|
||||
from .state import (
|
||||
DirtyFlags,
|
||||
GaugeState,
|
||||
animation_config,
|
||||
size_state_for_gauge,
|
||||
smoothing_config,
|
||||
update_state_size,
|
||||
)
|
||||
from .themes import GaugeStyle
|
||||
from .types import SmoothingConfig, StatusState, Tag
|
||||
from .types import StatusState, Tag
|
||||
|
||||
Rect = tuple[float, float, float, float]
|
||||
|
||||
@@ -97,7 +104,7 @@ class GaugeRenderer:
|
||||
if state.animation_state.active:
|
||||
state.displayed_value, active = advance_animation(state.animation_state, config, now)
|
||||
state.animation_state.active = active
|
||||
smoothing = _smoothing_config(state)
|
||||
smoothing = smoothing_config(state.config)
|
||||
if not state.animation_state.active and smoothing is not None and smoothing.enabled:
|
||||
state.displayed_value, _ = advance_smoothing(
|
||||
state.smoothing_state, state.clamped_value, smoothing
|
||||
@@ -640,13 +647,6 @@ def render_attached_gauge(state: GaugeState) -> None:
|
||||
state.renderer.render()
|
||||
|
||||
|
||||
def _smoothing_config(state: GaugeState) -> SmoothingConfig | None:
|
||||
smoothing = state.config.smoothing
|
||||
if isinstance(smoothing, bool):
|
||||
return SmoothingConfig(enabled=smoothing)
|
||||
return smoothing
|
||||
|
||||
|
||||
def _drawlist_tag(state: GaugeState) -> Tag:
|
||||
return cast(Tag, state.drawlist_tag)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user