New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ScrollView: Match scroll effect stop condition to start condition. #7213
Conversation
Doesn't seem to fix #7207 for me, if i drag the bar first, without touching anything before that, it crashes 100% of the time. |
Probably not the prettiest solution, but --- a/kivy/effects/kinetic.py
+++ b/kivy/effects/kinetic.py
@@ -145,7 +145,7 @@ def update(self, val, t=None):
See :meth:`start` for the arguments.
'''
t = t or time()
- distance = val - self.history[-1][1]
+ distance = val - (self.history[-1][1] if self.history else 0)
self.apply_distance(distance)
self.history.append((t, val))
if len(self.history) > self.max_history:
diff --git a/kivy/effects/scroll.py b/kivy/effects/scroll.py
index 7a722b8d7..f35b5c39b 100644
--- a/kivy/effects/scroll.py
+++ b/kivy/effects/scroll.py
@@ -113,7 +113,7 @@ def start(self, val, t=None):
return super(ScrollEffect, self).start(val, t)
def update(self, val, t=None):
- self.displacement += abs(val - self.history[-1][1])
+ self.displacement += abs(val - (self.history[-1][1] if self.history else 0))
return super(ScrollEffect, self).update(val, t)
def stop(self, val, t=None): seems to solve it for me without side effects. |
I overlooked that crash because when I translated from kivymd I didn't fully match the kivymd rules. But it should now be fixed for scroll move as well. |
The history fix would definitely fix it, but it doesn't fix the underlying issue. |
Right, but unless we have time to properly fix (and i can't promise i will) i would rather have that. |
Oh, yeah, my recent commit should have fixed it completely. |
…ivy#7213) * Match effect stop condition to start condition. * Also fix for scroll move.
Maintainer merge checklist
Component: xxx
label.api-deprecation
orapi-break
label.release-highlight
label to be highlighted in release notes.versionadded
,versionchanged
as needed.Fixes #7207.
Currently the stop condition is such that the effect stop may be executed even if the effect start was not called. Because the start and stop were guarded under different conditions. This makes them equal.