<s> '''<STR_LIT>''' <EOL> __all__ = ( '<STR_LIT>' , ) <EOL> from kivy . effects . kinetic import KineticEffect <EOL> from kivy . uix . widget import Widget <EOL> from kivy . properties import NumericProperty , ObjectProperty <EOL> class ScrollEffect ( KineticEffect ) : <EOL> '''<STR_LIT>''' <EOL> drag_threshold = NumericProperty ( '<STR_LIT>' ) <EOL> '''<STR_LIT>''' <EOL> min = NumericProperty ( <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> max = NumericProperty ( <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> scroll = NumericProperty ( <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> overscroll = NumericProperty ( <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> target_widget = ObjectProperty ( None , allownone = True , baseclass = Widget ) <EOL> '''<STR_LIT>''' <EOL> displacement = NumericProperty ( <NUM_LIT:0> ) <EOL> '''<STR_LIT>''' <EOL> def reset ( self , pos ) : <EOL> '''<STR_LIT>''' <EOL> self . value = pos <EOL> self . velocity = <NUM_LIT:0> <EOL> if self . history : <EOL> val = self . history [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] <EOL> super ( ScrollEffect , self ) . start ( val , None ) <EOL> def on_value ( self , * args ) : <EOL> scroll_min = self . min <EOL> scroll_max = self . max <EOL> if scroll_min > scroll_max : <EOL> scroll_min , scroll_max = scroll_max , scroll_min <EOL> if self . value < scroll_min : <EOL> self . overscroll = self . value - scroll_min <EOL> self . reset ( scroll_min ) <EOL> elif self . value > scroll_max : <EOL> self . overscroll = self . value - scroll_max <EOL> self . reset ( scroll_max ) <EOL> else : <EOL> self . scroll = self . value <EOL> def start ( self , val , t = None ) : <EOL> self . is_manual = True <EOL> self . displacement = <NUM_LIT:0> <EOL> return super ( ScrollEffect , self ) . start ( val , t ) <EOL> def update ( self , val , t = None ) : <EOL> self . displacement += abs ( val - self . history [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] ) <EOL> return super ( ScrollEffect , self ) . update ( val , t ) <EOL> def stop ( self , val , t = None ) : <EOL> self . is_manual = False <EOL> self . displacement += abs ( val - self . history [ - <NUM_LIT:1> ] [ <NUM_LIT:1> ] ) <EOL> if self . displacement <= self . drag_threshold : <EOL> self . velocity = <NUM_LIT:0> <EOL> return <EOL> return super ( ScrollEffect , self ) . stop ( val , t ) </s>
