Skip to content
Snippets Groups Projects
Commit 96ba3a83 authored by dos's avatar dos Committed by ave
Browse files

py,st3m: ViewManager: Don't count the first think into transition time

The first think after a transition starts tends to take a longer time
as the view gets instantiated. Allow the transition to actually play
by skipping the first time think gets called.
parent 1e5a9aaa
No related branches found
No related tags found
No related merge requests found
...@@ -190,6 +190,8 @@ class ViewManager(Responder): ...@@ -190,6 +190,8 @@ class ViewManager(Responder):
self._history: List[View] = [] self._history: List[View] = []
self._input = InputController() self._input = InputController()
self._first_think = False
def think(self, ins: InputState, delta_ms: int) -> None: def think(self, ins: InputState, delta_ms: int) -> None:
self._input.think(ins, delta_ms) self._input.think(ins, delta_ms)
...@@ -201,7 +203,10 @@ class ViewManager(Responder): ...@@ -201,7 +203,10 @@ class ViewManager(Responder):
self.pop(ViewTransitionSwipeRight()) self.pop(ViewTransitionSwipeRight())
if self._transitioning: if self._transitioning:
if not self._first_think:
self._transition += (delta_ms / 1000.0) * (1000 / self._time_ms) self._transition += (delta_ms / 1000.0) * (1000 / self._time_ms)
else:
self._first_think = False
if self._transition >= 1.0: if self._transition >= 1.0:
self._transition = 0 self._transition = 0
self._transitioning = False self._transitioning = False
...@@ -249,6 +254,7 @@ class ViewManager(Responder): ...@@ -249,6 +254,7 @@ class ViewManager(Responder):
self._transitioning = True self._transitioning = True
self._transition = 0.0 self._transition = 0.0
self._direction = direction self._direction = direction
self._first_think = True
self._outgoing = self._incoming self._outgoing = self._incoming
if self._outgoing is not None: if self._outgoing is not None:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment