Merge pull request #6224 from aAXEe/pinZoom-allowFractionalZoom
Pinch zoom: allow fractional zoom
This commit is contained in:
10
examples/pinchZoom.html
Normal file
10
examples/pinchZoom.html
Normal file
@@ -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>
|
||||
25
examples/pinchZoom.js
Normal file
25
examples/pinchZoom.js
Normal file
@@ -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
|
||||
})
|
||||
});
|
||||
Reference in New Issue
Block a user