Better save and restore map state when entering walkthrough

(should cut down on errant edits in Three Rivers, MI)
This commit is contained in:
Bryan Housel
2015-12-10 14:02:16 -08:00
parent 20a80830fe
commit 239abdf4e7

View File

@@ -9,6 +9,8 @@ iD.ui.intro = function(context) {
// Save current map state
var history = context.history().toJSON(),
hash = window.location.hash,
center = context.map().center(),
zoom = context.map().zoom(),
background = context.background().baseLayerSource(),
opacity = d3.select('.background-layer').style('opacity'),
loadedTiles = context.connection().loadedTiles(),
@@ -62,6 +64,7 @@ iD.ui.intro = function(context) {
context.history().reset().merge(d3.values(baseEntities));
context.background().baseLayerSource(background);
if (history) context.history().fromJSON(history, false);
context.map().centerZoom(center, zoom);
window.location.replace(hash);
context.inIntro(false);
d3.select('#bar button.save').on('click', save);