summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCode WvS <code-wvs@quantentunnel.de>2015-03-01 15:57:28 +0100
committerCode WvS <code-wvs@quantentunnel.de>2015-03-01 15:57:28 +0100
commit5b615ebf5cfc4f6aa6c5930dcc7ec7e211e883df (patch)
treeb2283ff24c0d6f53bcacc489e9a23645efb99ca7
parent0722cd0a636d272502a03434dfe91386c0624d82 (diff)
downloadsnap-yow-5b615ebf5cfc4f6aa6c5930dcc7ec7e211e883df.tar.gz
snap-yow-5b615ebf5cfc4f6aa6c5930dcc7ec7e211e883df.zip
don't hide the markers on map resize
-rw-r--r--gui.js6
-rwxr-xr-xsnap.html11
2 files changed, 12 insertions, 5 deletions
diff --git a/gui.js b/gui.js
index 13d2071..7c4315c 100644
--- a/gui.js
+++ b/gui.js
@@ -241,9 +241,6 @@ IDE_Morph.prototype.init = function (isAutoFill) {
this.loadNewProject = false; // flag when starting up translated
this.shield = null;
- // initialize inherited properties:
- IDE_Morph.uber.init.call(this);
-
// Snap! YOW
// set initial sprite position after the map has loaded
// The map center is set at the same time as 'geoposition'
@@ -260,6 +257,9 @@ IDE_Morph.prototype.init = function (isAutoFill) {
window.map.getCenter().lat);
}
+ // initialize inherited properties:
+ IDE_Morph.uber.init.call(this);
+
// override inherited properites:
this.color = this.backgroundColor;
};
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: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> 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();