UNPKG

leaflet

Version:

JavaScript library for mobile-friendly interactive maps

57 lines (44 loc) 1.9 kB
<!DOCTYPE html> <html> <head> <meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" /> <script type="text/javascript" src="../../build/deps.js"></script> <script src="../leaflet-include.js"></script> <script src="../../node_modules/prosthetic-hand/dist/prosthetic-hand.js"></script> <meta charset="utf-8"> <title>Leaflet test for pinch-zoom-without-bounce</title> <style> #map { width:100vw; height:100vh; margin:0; } body {margin:0; padding: 0} </style> </head> <body> <div id='map'></div> <script> // Remember to include either the Leaflet 0.7.3 or the Leaflet 1.0.0-beta1 library var myCenter = new L.LatLng(50.5, 30.51); var map = new L.Map('map', { center: myCenter, zoom: 15, minZoom: 5, maxZoom: 16, bounceAtZoomLimits: false }); //In any map, set minZoom and/or maxZoom, plus bounceAtZoomLimits to false. var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>' }).addTo(map); var marker = new L.Marker(myCenter); map.addLayer(marker); marker.bindPopup("<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p><p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</p>"); map.on('move', function(ev){ console.log('map move event A ', map._lastCenter, map._zoom, map._pixelOrigin); console.log('map move event B ', map.getCenter()); }); </script> </body> </html>