Enjoyable content drag-to-scroll library
Added props:
lockScrollOnDragDirection
, preventDefaultOnEmulateScroll
, dragDirectionTolerance
, onPointerDown
, onPointerUp
, onPointerMove
, onWheel
Handler methods now receives third parameter isTouch
to detect whether it is called on touch device or desktop.
Removed prop and breaking changes:
pointerDownPreventDefault
. Use lockScrollOnDragDirection: 'all'
as a replacement, but by default this behavior is now disabled (this means on touch devices all viewport will scroll along scrollable area, use prop lockScrollOnDragDirection
to change this behavior for your needs)
Fixed click event on mobile devices
Thanks to @alexwidua and @bragovo for contributions: https://github.com/ilyashubin/scrollbooster/pull/47 Lock scroll when dragged horizontally/vertically https://github.com/ilyashubin/scrollbooster/pull/46 Add onWheel callback for swap axes
pointerDownPreventDefault
option to control window scroll on mobile devicesRelease to simplify basic library usage. Prepare to React release
scrollMode
option to perform CSS or native scrolling by library itself, no more need to pass onUpdate
and handle scroll logic manually. It is optional thoughupdateOptions
method - now it can update all supported optionsAdded new state property borderCollision
to check which boundaries positions are reached while scrolling
handle
optionmode
option to direction
(supported values has changed to horizontal
, vertical
or all
)inputsFocus
optionpointerMode
optionscrollTo
methodupdateOptions
methodgetUpdate
method to getState
State object is passed to onUpdate
, onClick
and shouldScroll
options as first param. Old state param has props isRunning
, isDragging
, isScrolling
, position
, dragOffsetPosition
, viewport
and content
.
Some of these props were misleading and caused confusion. New state param only contains isMoving
, isDragging
, position
and dragOffset
properties.
ScrollBooster now listens images load
event in scrollable content and updates its metrics automatically, so no need to call updateMetrics
manually