diff --git a/js/id/modes/select.js b/js/id/modes/select.js index b41384a3a..a284ba75f 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -187,8 +187,17 @@ iD.modes.Select = function(context, selectedIDs) { context.uninstall(behavior); }); - var q = iD.util.stringQs(location.hash.substring(1)); - location.replace('#' + iD.util.qsString(_.omit(q, 'id'), true)); + var q = _.omit(iD.util.stringQs(location.hash.substring(1)), 'id'), + center = context.map().center(), + zoom = context.map().zoom(), + precision = Math.max(0, Math.ceil(Math.log(zoom) / Math.LN2)), + newhash = '#' + iD.util.qsString(_.assign(q, { + map: zoom.toFixed(2) + + '/' + center[0].toFixed(precision) + + '/' + center[1].toFixed(precision) + }), true); + + location.replace(newhash); keybinding.off(); diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 4138dad1a..d5d3dd9de 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -126,8 +126,12 @@ iD.Map = function(context) { } function editOff() { + var mode = context.mode(); surface.selectAll('.layer *').remove(); dispatch.drawn({full: true}); + if (!(mode && mode.id === 'browse')) { + context.enter(iD.modes.Browse(context)); + } } function zoomPan() { diff --git a/test/spec/modes/add_point.js b/test/spec/modes/add_point.js index e45814740..0a3e375a2 100644 --- a/test/spec/modes/add_point.js +++ b/test/spec/modes/add_point.js @@ -11,6 +11,7 @@ describe("iD.modes.AddPoint", function() { .append('div') .attr('class', 'inspector-wrap'); + context.map().centerZoom([-77.02271, 38.90085], 20); context.enter(iD.modes.AddPoint(context)); });