javascript - Leaflet.js map has extra grey space on all sides and lets me drag infinitively -
i using leaflet.js generate map layover information. turned on nowrap option world not repeat. however, there lot of unlimited grey on sides. can drag area infinitely. unfortunately, need have drag functionality around map when zoomed in. has run problem? doesn't seem css has effect on problem. information great!
kirie
var map = l.map('map').setview([41.9, 12.5], 2); l.tilelayer(tileserverurl, { attribution: tileserverattribution, maxzoom: 16, minzoom: 2, nowrap: true }).addto(map); map.keyboard.disable(); var bounds = map.getbounds(); var southwest = bounds.getsouthwest(); var northeast = bounds.getnortheast(); bounds = l.latlngbounds(southwest,northeast); map.setmaxbounds(bounds);
you have use "maxbounds" block dragging bounds : here's sample : https://www.mapbox.com/mapbox.js/example/v1.0.0/maxbounds/
Comments
Post a Comment