From 150dcf471e30873cc2ed7b28c99dc90b10adf60f Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Thu, 13 Dec 2012 13:37:46 -0800 Subject: [PATCH] Chain --- js/id/modes/draw_area.js | 10 ++++++---- js/id/modes/draw_line.js | 12 ++++++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index 3640131cd..12f04d283 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -95,8 +95,9 @@ iD.modes.DrawArea = function(wayId) { controller.enter(iD.modes.Browse()); } - map.surface.on('mousemove.drawarea', mousemove); - map.surface.on('click.drawarea', click); + map.surface + .on('mousemove.drawarea', mousemove) + .on('click.drawarea', click); map.keybinding() .on('⎋.drawarea', esc) @@ -106,8 +107,9 @@ iD.modes.DrawArea = function(wayId) { }; mode.exit = function() { - mode.map.hint(false); - mode.map.fastEnable(true); + mode.map + .hint(false) + .fastEnable(true); mode.map.surface .on('mousemove.drawarea', null) diff --git a/js/id/modes/draw_line.js b/js/id/modes/draw_line.js index 2320354f9..b9b8e4409 100644 --- a/js/id/modes/draw_line.js +++ b/js/id/modes/draw_line.js @@ -24,11 +24,11 @@ iD.modes.DrawLine = function(wayId, direction) { iD.actions.AddNode(node), iD.actions.AddWayNode(wayId, node.id, index)); - map.surface.on('mousemove.drawline', function() { + function mousemove() { history.replace(iD.actions.Move(node.id, map.mouseCoordinates())); - }); + } - map.surface.on('click.drawline', function() { + function click() { var datum = d3.select(d3.event.target).datum() || {}; if (datum.id === tailId) { @@ -72,7 +72,7 @@ iD.modes.DrawLine = function(wayId, direction) { controller.enter(iD.modes.DrawLine(wayId, direction)); } - }); + } function esc() { history.replace( @@ -108,6 +108,10 @@ iD.modes.DrawLine = function(wayId, direction) { controller.enter(iD.modes.Browse()); } + map.surface + .on('mousemove.drawline', mousemove) + .on('click.drawline', click); + map.keybinding() .on('⎋.drawline', esc) .on('⌫.drawline', backspace)