diff --git a/frontend/app/app.js b/frontend/app/app.js index 17993c25..c803565e 100644 --- a/frontend/app/app.js +++ b/frontend/app/app.js @@ -90,7 +90,7 @@ var FacilPad = { map.socket.$watch("padId", function(padId) { if(padId) - history.replaceState(null, "", $scope.urlPrefix + padId); + history.replaceState(null, "", $scope.urlPrefix + padId + location.hash); }); }, 0); diff --git a/frontend/app/map/map/map.js b/frontend/app/map/map/map.js index 7dffa372..8c61f765 100644 --- a/frontend/app/map/map/map.js +++ b/frontend/app/map/map/map.js @@ -106,6 +106,8 @@ iconLoading: "glyphicon glyphicon-screenshot" }).addTo(map.map); + L.hash(map.map, map.layers); + map.map.on('almost:over', function(e) { e.layer.fire('fp-almostover', e); $(map.map.getContainer()).addClass("fp-almostover"); @@ -275,7 +277,10 @@ var loadedWatcher = map.socket.$watch("padData", function(padData) { if(padData != null) { loadedWatcher(); - map.displayView(padData.defaultView); + + if(!map.map._loaded) // hash control might have set a location already + map.displayView(padData.defaultView); + scope.loaded = true; } }); diff --git a/frontend/bower.json b/frontend/bower.json index a2868bf2..4298beac 100644 --- a/frontend/bower.json +++ b/frontend/bower.json @@ -31,7 +31,8 @@ "leaflet.locatecontrol": "^0.55.0", "clipboard": "^1.5.12", "togeojson": "https://github.com/mapbox/togeojson/raw/master/togeojson.js", - "osmtogeojson": "^2.2.12" + "osmtogeojson": "^2.2.12", + "leaflet-fullHash": "https://raw.githubusercontent.com/KoGor/leaflet-fullHash/master/leaflet-fullHash.js" }, "overrides": { "bootstrap": {