mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 21:48:20 +02:00
Don't let window.location changes happen during draw modes
(closes #3996)
This commit is contained in:
@@ -125,8 +125,15 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
|
||||
|
||||
|
||||
drawWay.off = function(surface) {
|
||||
context.pop(tempEdits);
|
||||
tempEdits = 0;
|
||||
// Drawing was interrupted unexpectedly.
|
||||
// This can happen if the user changes modes,
|
||||
// clicks geolocate button, a hashchange event occurs, etc.
|
||||
if (tempEdits) {
|
||||
context.pop(tempEdits);
|
||||
while (context.graph() !== startGraph) {
|
||||
context.pop();
|
||||
}
|
||||
}
|
||||
|
||||
context.map()
|
||||
.on('drawn.draw', null);
|
||||
@@ -268,7 +275,7 @@ export function behaviorDrawWay(context, wayId, index, mode, startGraph) {
|
||||
tempEdits = 0;
|
||||
|
||||
var way = context.hasEntity(wayId);
|
||||
if (!way || origWay.isDegenerate()) {
|
||||
if (!way || way.isDegenerate()) {
|
||||
drawWay.cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as d3 from 'd3';
|
||||
import _ from 'lodash';
|
||||
import { utilQsString, utilStringQs } from '../util/index';
|
||||
import { modeBrowse } from '../modes';
|
||||
import { utilQsString, utilStringQs } from '../util';
|
||||
|
||||
|
||||
export function behaviorHash(context) {
|
||||
@@ -14,8 +15,11 @@ export function behaviorHash(context) {
|
||||
if (args.length < 3 || args.some(isNaN)) {
|
||||
return true; // replace bogus hash
|
||||
} else if (s !== formatter(map).slice(1)) {
|
||||
map.centerZoom([args[2],
|
||||
Math.min(lat, Math.max(-lat, args[1]))], args[0]);
|
||||
var mode = context.mode();
|
||||
if (mode && mode.id.match(/^draw/) !== null) {
|
||||
context.enter(modeBrowse(context));
|
||||
}
|
||||
map.centerZoom([args[2], Math.min(lat, Math.max(-lat, args[1]))], args[0]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user