diff --git a/python_payload/main.py b/python_payload/main.py index c4aeba5a2187deb77fd8c25a3d91ff32b280c984..1807af46193c8d20e0440f4007d7d6e66fdf9215 100644 --- a/python_payload/main.py +++ b/python_payload/main.py @@ -54,7 +54,7 @@ melodic._view_manager = vm nick._view_manager = vm captouch._view_manager = vm -menu_music = SunMenu( +menu_music = SimpleMenu( [ MenuItemBack(), MenuItemForeground("Harmonic", harmonic), @@ -66,7 +66,7 @@ menu_music = SunMenu( vm, ) -menu_apps = SunMenu( +menu_apps = SimpleMenu( [ MenuItemBack(), MenuItemForeground("captouch", captouch), @@ -76,7 +76,7 @@ menu_apps = SunMenu( ) -menu_badge = SunMenu( +menu_badge = SimpleMenu( [ MenuItemBack(), MenuItemForeground("nick", nick), diff --git a/python_payload/st4m/ui/interactions.py b/python_payload/st4m/ui/interactions.py index 864fd29d41b66189f31767788c91a1e4dd39f902..e9dac9ceb22c09a292ef020f1b69fbe9eeb8e0a3 100644 --- a/python_payload/st4m/ui/interactions.py +++ b/python_payload/st4m/ui/interactions.py @@ -72,7 +72,6 @@ class ScrollController(st4m.Responder): self._current_position = 0 self._velocity = 0 return - if self.wrap: self._target_position = self._target_position % self._nitems else: @@ -248,13 +247,19 @@ class GestureScrollController(ScrollController): self._velocity = speed - self._current_position = ( - self._current_position + self._velocity * delta_ms - ) % self._nitems + self._current_position = self._current_position + self._velocity * delta_ms + + if self.wrap: + self._current_position = self._current_position % self._nitems + elif round(self._current_position) < 0: + self._current_position = 0 + elif round(self._current_position) >= self._nitems: + self._current_position = self._nitems - 1 if phase != self._petal._input.UP: return + pos = round(self._current_position) microstep = round(self._current_position) - self._current_position # print("micro:", microstep) # print("v", self._velocity)