-
- All Implemented Interfaces:
-
com.patrykandpatrick.vico.core.scroll.ScrollListenerHost
public final class ScrollHandler implements ScrollListenerHost
Handles scroll events.
-
-
Field Summary
Fields Modifier and Type Field Description private Floatvalueprivate FloatmaxValueprivate FloatcurrentScrollprivate FloatmaxScrollDistance
-
Constructor Summary
Constructors Constructor Description ScrollHandler(Function1<Float, Unit> setScrollAmount, Float maxScrollDistance)Handles scroll events. ScrollHandler(Float initialMaxValue)
-
Method Summary
Modifier and Type Method Description final FloatgetValue()The current scroll amount (in pixels). final UnitsetValue(Float value)The current scroll amount (in pixels). final FloatgetMaxValue()The maximum scroll amount (in pixels). final UnitsetMaxValue(Float maxValue)The maximum scroll amount (in pixels). final FloatgetCurrentScroll()final UnitsetCurrentScroll(@Deprecated(message = Use the `value` field instead., level = DeprecationLevel.ERROR) Float currentScroll)final FloatgetMaxScrollDistance()final UnitsetMaxScrollDistance(@Deprecated(message = Use the `maxValue` field instead., level = DeprecationLevel.ERROR) Float maxScrollDistance)final FloathandleScrollDelta(Float delta)Increments value by delta if the result of the operation belongs to the interval [0, maxValue]. final BooleancanScrollBy(Float delta)Checks whether a scroll by the given delta value is possible. final FloathandleScroll(Float targetScroll)Updates value to targetScroll, which is restricted to the interval [0, maxValue]. final UnithandleInitialScroll(InitialScroll initialScroll)Updates value to match the provided InitialScroll. UnitregisterScrollListener(ScrollListener scrollListener)Registers a ScrollListener. UnitremoveScrollListener(ScrollListener scrollListener)Removes a ScrollListener. -
-
Constructor Detail
-
ScrollHandler
ScrollHandler(Function1<Float, Unit> setScrollAmount, Float maxScrollDistance)
Handles scroll events.- Parameters:
setScrollAmount- called when the scroll amount changes.maxScrollDistance- the initial maximum scroll amount.
-
ScrollHandler
ScrollHandler(Float initialMaxValue)
- Parameters:
initialMaxValue- the initial maximum scroll amount.
-
-
Method Detail
-
getMaxValue
final Float getMaxValue()
The maximum scroll amount (in pixels).
-
setMaxValue
final Unit setMaxValue(Float maxValue)
The maximum scroll amount (in pixels).
-
getCurrentScroll
final Float getCurrentScroll()
-
setCurrentScroll
final Unit setCurrentScroll(@Deprecated(message = Use the `value` field instead., level = DeprecationLevel.ERROR) Float currentScroll)
-
getMaxScrollDistance
final Float getMaxScrollDistance()
-
setMaxScrollDistance
final Unit setMaxScrollDistance(@Deprecated(message = Use the `maxValue` field instead., level = DeprecationLevel.ERROR) Float maxScrollDistance)
-
handleScrollDelta
final Float handleScrollDelta(Float delta)
-
canScrollBy
final Boolean canScrollBy(Float delta)
Checks whether a scroll by the given delta value is possible.
-
handleScroll
final Float handleScroll(Float targetScroll)
Updates value to targetScroll, which is restricted to the interval [0, maxValue].
-
handleInitialScroll
final Unit handleInitialScroll(InitialScroll initialScroll)
Updates value to match the provided InitialScroll.
-
registerScrollListener
Unit registerScrollListener(ScrollListener scrollListener)
Registers a ScrollListener.
-
removeScrollListener
Unit removeScrollListener(ScrollListener scrollListener)
Removes a ScrollListener.
-
-
-
-