You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Call map.scrollZoom.disable() (or set scrollZoom to false in options when creating map)
Call map.scrollZoom.enable()
Call map.scrollZoom.enable({ around: 'center' })
Expected Behavior
Calling enable() the second time should apply the options object and make the scroll zoom handler scroll around the centre of the map instead of the cursor.
Actual Behavior
The scroll zoom handler does not apply the options on the second call.
The opposite is true also; calling enable() with options and then calling enable() again without options will not properly reset the options.
@bartcorremans thanks for using mapbox and for the detailed report!
As the function is written, if you call map.scrollZoom.enable() when the control is already enabled, it returns without doing anything, and this is consistent with the rest of our mouse/keyboard handlers. Your example works if you add a call to map.scrollZoom.disable() in the first timeout.
It might make sense to add a method that allows users to set the around option separately from enabling/disabling the handler.
mapbox-gl-js version: v0.41.0
Steps to Trigger Behavior
map.scrollZoom.disable()
(or setscrollZoom
tofalse
in options when creating map)map.scrollZoom.enable()
map.scrollZoom.enable({ around: 'center' })
Expected Behavior
Calling
enable()
the second time should apply the options object and make the scroll zoom handler scroll around the centre of the map instead of the cursor.Actual Behavior
The scroll zoom handler does not apply the options on the second call.
The opposite is true also; calling
enable()
with options and then callingenable()
again without options will not properly reset the options.https://jsbin.com/tupovojawu/1/edit?html,js,output
The text was updated successfully, but these errors were encountered: