mirror of
https://github.com/FoggedLens/iD.git
synced 2026-04-21 11:16:36 +02:00
Fix exiting draw mode via other means (fixes #503)
This commit is contained in:
@@ -4,6 +4,7 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
controller = mode.controller,
|
||||
event = d3.dispatch('add', 'addHead', 'addTail', 'addNode', 'addWay'),
|
||||
way = mode.history.graph().entity(wayId),
|
||||
finished = false,
|
||||
hover, draw;
|
||||
|
||||
var node = iD.Node({loc: map.mouseCoordinates()}),
|
||||
@@ -56,6 +57,9 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
};
|
||||
|
||||
drawWay.off = function(surface) {
|
||||
if (!finished)
|
||||
history.pop();
|
||||
|
||||
map.fastEnable(true)
|
||||
.minzoom(0)
|
||||
.tail(false);
|
||||
@@ -86,6 +90,7 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
ReplaceTemporaryNode(node),
|
||||
annotation);
|
||||
|
||||
finished = true;
|
||||
controller.enter(mode);
|
||||
};
|
||||
|
||||
@@ -99,6 +104,7 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
ReplaceTemporaryNode(newNode),
|
||||
annotation);
|
||||
|
||||
finished = true;
|
||||
controller.enter(mode);
|
||||
};
|
||||
|
||||
@@ -111,6 +117,7 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
ReplaceTemporaryNode(newNode),
|
||||
annotation);
|
||||
|
||||
finished = true;
|
||||
controller.enter(mode);
|
||||
};
|
||||
|
||||
@@ -118,6 +125,7 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
// nodes to be valid, it's selected. Otherwise, return to browse mode.
|
||||
drawWay.finish = function() {
|
||||
history.pop();
|
||||
finished = true;
|
||||
|
||||
var way = history.graph().entity(wayId);
|
||||
if (way) {
|
||||
@@ -129,7 +137,11 @@ iD.behavior.DrawWay = function(wayId, headId, tailId, index, mode, baseGraph) {
|
||||
|
||||
// Cancel the draw operation and return to browse, deleting everything drawn.
|
||||
drawWay.cancel = function() {
|
||||
history.perform(d3.functor(baseGraph), 'cancelled drawing');
|
||||
history.perform(
|
||||
d3.functor(baseGraph),
|
||||
'cancelled drawing');
|
||||
|
||||
finished = true;
|
||||
controller.enter(iD.modes.Browse());
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user