tkivy: fix animate_to_center - electrum - Electrum Bitcoin wallet
HTML git clone https://git.parazyd.org/electrum
DIR Log
DIR Files
DIR Refs
DIR Submodules
---
DIR commit 4195001aed9a5a307cbd83b19f9e66af390643b6
DIR parent 1b0e29d385ccd62dbb55a47e768a32e5f0125358
HTML Author: ThomasV <thomasv@electrum.org>
Date: Thu, 10 Dec 2015 15:26:38 +0100
kivy: fix animate_to_center
Diffstat:
M gui/kivy/uix/screens.py | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
---
DIR diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
t@@ -380,20 +380,9 @@ class TabbedCarousel(Factory.TabbedPanel):
scrlv = self._tab_strip.parent
if not scrlv:
return
-
idx = self.tab_list.index(value)
- if idx == 0:
- scroll_x = 1
- elif idx == len(self.tab_list) - 1:
- scroll_x = 0
- else:
- self_center_x = scrlv.center_x
- vcenter_x = value.center_x
- diff_x = (self_center_x - vcenter_x)
- try:
- scroll_x = scrlv.scroll_x - (diff_x / scrlv.width)
- except ZeroDivisionError:
- pass
+ n = len(self.tab_list)
+ scroll_x = 1. * (n - idx - 1) / (n - 1)
mation = Factory.Animation(scroll_x=scroll_x, d=.25)
mation.cancel_all(scrlv)
mation.start(scrlv)