|
|
|
@ -3,7 +3,6 @@ from functools import partial |
|
|
|
|
from typing import cast |
|
|
|
|
|
|
|
|
|
import pyray as rl |
|
|
|
|
from openpilot.common.filter_simple import FirstOrderFilter |
|
|
|
|
from openpilot.common.params import Params |
|
|
|
|
from openpilot.system.ui.lib.application import gui_app |
|
|
|
|
from openpilot.system.ui.lib.scroll_panel import GuiScrollPanel |
|
|
|
@ -50,16 +49,6 @@ class NavButton(Widget): |
|
|
|
|
super().__init__() |
|
|
|
|
self.text = text |
|
|
|
|
self.set_rect(rl.Rectangle(0, 0, 400, 100)) |
|
|
|
|
self._x_pos_filter = FirstOrderFilter(0.0, 0.05, 1 / gui_app.target_fps, initialized=False) |
|
|
|
|
self._y_pos_filter = FirstOrderFilter(0.0, 0.05, 1 / gui_app.target_fps, initialized=False) |
|
|
|
|
|
|
|
|
|
def set_position(self, x: float, y: float) -> None: |
|
|
|
|
x = self._x_pos_filter.update(x) |
|
|
|
|
y = self._y_pos_filter.update(y) |
|
|
|
|
changed = (self._rect.x != x or self._rect.y != y) |
|
|
|
|
self._rect.x, self._rect.y = x, y |
|
|
|
|
if changed: |
|
|
|
|
self._update_layout_rects() |
|
|
|
|
|
|
|
|
|
def _render(self, _): |
|
|
|
|
color = rl.Color(74, 74, 74, 255) if self.is_pressed else rl.Color(57, 57, 57, 255) |
|
|
|
|