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 #6224 from aAXEe/pinZoom-allowFractionalZoom
Pinch zoom: allow fractional zoom
- Loading branch information
Showing
5 changed files
with
70 additions
and
7 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
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
layout: example.html | ||
title: PinchZoom | ||
shortdesc: A basic example for a pinch zoom with a restriction to integer zooms. | ||
docs: > | ||
<p>Use a pinch zoom gesture to zoom the map. | ||
After the gesture the map will zoomed to the next whole-number zoom level with an animtation.</p> | ||
tags: "pinch, zoom, interaction" | ||
--- | ||
<div 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
goog.require('ol.Map'); | ||
goog.require('ol.View'); | ||
goog.require('ol.interaction'); | ||
goog.require('ol.interaction.PinchZoom'); | ||
goog.require('ol.layer.Tile'); | ||
goog.require('ol.source.OSM'); | ||
|
||
|
||
var map = new ol.Map({ | ||
interactions: ol.interaction.defaults({pinchZoom: false}).extend([ | ||
new ol.interaction.PinchZoom({ | ||
constrainResolution: true // force zooming to a integer zoom | ||
}) | ||
]), | ||
layers: [ | ||
new ol.layer.Tile({ | ||
source: new ol.source.OSM() | ||
}) | ||
], | ||
target: 'map', | ||
view: new ol.View({ | ||
center: [0, 0], | ||
zoom: 2 | ||
}) | ||
}); |
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