Add a zoom setting to MouseWheelZoomInteraction
By default, zooming in or out zooms using the mouse's location as an anchor, which makes it possible to navigate the map using scrolling only, and makes zooming in more intuitive. This commit adds a new useAnchor option to the MouseWheelZoom interaction. It is enabled by default, which changes nothing to the current behavior of the interaction. When disabled, the interaction stops registering its lastAnchor_ value. This turns the zoom into a very basic one, that zooms to the center of the screen. To use the map center zoom, set the useAnchor option to false when creating the MouseWheelZoomInteraction, or use its setMouseAnchor function.
This commit is contained in:
@@ -243,6 +243,9 @@ describe('ol.Map', function() {
|
||||
var interactions = ol.interaction.defaults(options);
|
||||
expect(interactions.getLength()).to.eql(1);
|
||||
expect(interactions.item(0)).to.be.a(ol.interaction.MouseWheelZoom);
|
||||
expect(interactions.item(0).useAnchor_).to.eql(true);
|
||||
interactions.item(0).setMouseAnchor(false);
|
||||
expect(interactions.item(0).useAnchor_).to.eql(false);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user