From 5b615ebf5cfc4f6aa6c5930dcc7ec7e211e883df Mon Sep 17 00:00:00 2001 From: Code WvS Date: Sun, 1 Mar 2015 15:57:28 +0100 Subject: don't hide the markers on map resize --- snap.html | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'snap.html') diff --git a/snap.html b/snap.html index 598b71c..7f609d0 100755 --- a/snap.html +++ b/snap.html @@ -71,8 +71,9 @@ // Sets the view on the first locate function firstLocate (e) { - setGlobalPosition(e); map.stopLocate(); + map.setView(e.latlng, 18); + setGlobalPosition(e); map.on('locationfound', setGlobalPosition); map.locate({watch: true, enableHighAccuracy: true}); } @@ -87,6 +88,12 @@ }); // The map steals the key events, so the 'world' canvas has to be focused map.on('mouseover', function() {document.getElementById('world').focus();}); + // Resizing hides the markers + map.on('resize', function() { + ide.sprites.asArray().forEach(function (sprite) { + sprite.updateMarker(); + }); + }); layer = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' @@ -100,7 +107,7 @@ // continuously update the local location variable map.on('locationfound', firstLocate); - map.locate({setView: true, enableHighAccuracy: true}); + map.locate({enableHighAccuracy: true}); // OSMBuildings provides fancy 3D buildings new OSMBuildings(map).load(); -- cgit v1.3.1