forked from openlayers/openlayers
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openlayers#7904 from ahocevar/focus-scroll
Add focus condition, e.g. for wheel zoom
- Loading branch information
Showing
3 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,18 @@ | ||
--- | ||
layout: example.html | ||
title: Mousewheel/Trackpad Zoom | ||
shortdesc: Restrict wheel/trackpad zooming to integer zoom levels. | ||
shortdesc: Shows advanced wheel/trackpad zoom options. | ||
docs: > | ||
By default, the `ol.interaction.MouseWheelZoom` can leave the map at | ||
fractional zoom levels. If instead you want to constrain wheel/trackpad | ||
zooming to integer zoom levels, set <code>constrainResolution: true</code> | ||
when constructing the interaction. | ||
tags: "trackpad, mousewheel, zoom, interaction" | ||
This example uses a custom `ol.interaction.MouseWheelZoom` configuration: | ||
|
||
* By default, wheel/trackpad zoom is always active, which can be unexpected | ||
on pages with a lot of scrollable content and an embedded map. To perform | ||
wheel/trackpad zoom actions only when the map has the focus, set | ||
`condition: ol.events.condition.focus` as constructor option. This requires | ||
a map div with a `tabindex` attribute set. | ||
* By default, the interaction can leave the map at fractional zoom levels. If | ||
instead you want to constrain wheel/trackpad zooming to integer zoom | ||
levels, set `constrainResolution: true`. | ||
tags: "trackpad, mousewheel, zoom, scroll, interaction" | ||
--- | ||
<div id="map" class="map"></div> | ||
<div tabindex="1" id="map" class="map"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters