mirror of https://github.com/kivy/kivy.git
fix carousel bug with load_next, make _start_animation interface more flexible
This commit is contained in:
parent
284b402a95
commit
6ef8c427aa
|
@ -282,8 +282,8 @@ class Carousel(StencilView):
|
|||
_offset = _direction[self.direction]
|
||||
if mode == 'prev':
|
||||
_offset = -_offset
|
||||
self._offset = _offset
|
||||
self._start_animation()
|
||||
|
||||
self._start_animation(min_move=0, offset=_offset)
|
||||
|
||||
def get_slide_container(self, slide):
|
||||
return slide.parent
|
||||
|
@ -433,14 +433,15 @@ class Carousel(StencilView):
|
|||
index += 1
|
||||
self.index = index
|
||||
|
||||
def _start_animation(self, *args):
|
||||
def _start_animation(self, *args, **kwargs):
|
||||
# compute target offset for ease back, next or prev
|
||||
new_offset = 0
|
||||
direction = self.direction
|
||||
direction = kwargs.get('direction', self.direction)
|
||||
is_horizontal = direction[0] in ['r', 'l']
|
||||
extent = self.width if is_horizontal else self.height
|
||||
min_move = self.min_move
|
||||
_offset = self._offset
|
||||
min_move = kwargs.get('min_move', self.min_move)
|
||||
_offset = kwargs.get('offset', self._offset)
|
||||
|
||||
if _offset < min_move * -extent:
|
||||
new_offset = -extent
|
||||
elif _offset > min_move * extent:
|
||||
|
|
Loading…
Reference in New Issue