diff --git a/js/id/modes/add_area.js b/js/id/modes/add_area.js index 33facb041..8051da962 100644 --- a/js/id/modes/add_area.js +++ b/js/id/modes/add_area.js @@ -12,6 +12,7 @@ iD.modes.AddArea = function() { controller = mode.controller; map.dblclickEnable(false) + .hoverEnable(false) .hint('Click on the map to start drawing an area, like a park, lake, or building.'); map.surface.on('click.addarea', function() { @@ -47,7 +48,8 @@ iD.modes.AddArea = function() { mode.exit = function() { window.setTimeout(function() { - mode.map.dblclickEnable(true); + mode.map.dblclickEnable(true) + .hoverEnable(true); }, 1000); mode.map.hint(false); mode.map.surface.on('click.addarea', null); diff --git a/js/id/modes/add_line.js b/js/id/modes/add_line.js index baa4364bc..0c3ef27aa 100644 --- a/js/id/modes/add_line.js +++ b/js/id/modes/add_line.js @@ -13,6 +13,8 @@ iD.modes.AddLine = function() { controller = mode.controller; map.dblclickEnable(false) + .hoverEnable(false) + .hoverEnable(false) .hint('Click on the map to start drawing an road, path, or route.'); map.surface.on('click.addline', function() { @@ -68,7 +70,7 @@ iD.modes.AddLine = function() { }; mode.exit = function() { - mode.map.dblclickEnable(true); + mode.map.dblclickEnable(true).hoverEnable(true); mode.map.hint(false); mode.map.surface.on('click.addline', null); mode.map.keybinding().on('⎋.addline', null); diff --git a/js/id/modes/add_point.js b/js/id/modes/add_point.js index 37767f3de..677830b32 100644 --- a/js/id/modes/add_point.js +++ b/js/id/modes/add_point.js @@ -10,6 +10,8 @@ iD.modes.AddPoint = function() { history = mode.history, controller = mode.controller; + map.hoverEnable(false); + map.hint('Click on the map to add a point.'); map.surface.on('click.addpoint', function() { @@ -28,6 +30,7 @@ iD.modes.AddPoint = function() { }; mode.exit = function() { + map.hoverEnable(true); mode.map.hint(false); mode.map.surface.on('click.addpoint', null); mode.map.keybinding().on('⎋.addpoint', null); diff --git a/js/id/modes/draw_area.js b/js/id/modes/draw_area.js index 00ef6590f..e54163dda 100644 --- a/js/id/modes/draw_area.js +++ b/js/id/modes/draw_area.js @@ -16,6 +16,7 @@ iD.modes.DrawArea = function(wayId) { node = iD.Node({loc: map.mouseCoordinates()}); map.dblclickEnable(false) + .hoverEnable(false) .fastEnable(false); map.hint('Click on the map to add points to your area. Finish the ' + 'area by clicking on your first point'); @@ -125,7 +126,8 @@ iD.modes.DrawArea = function(wayId) { mode.exit = function() { mode.map.hint(false); - mode.map.fastEnable(true); + mode.map.fastEnable(true) + .hoverEnable(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 b7e614012..56c5cfe6b 100644 --- a/js/id/modes/draw_line.js +++ b/js/id/modes/draw_line.js @@ -16,6 +16,7 @@ iD.modes.DrawLine = function(wayId, direction) { map.dblclickEnable(false) .fastEnable(false) + .hoverEnable(false) .hint('Click to add more points to the line. ' + 'Click on other lines to connect to them, and double-click to ' + 'end the line.'); @@ -121,7 +122,8 @@ iD.modes.DrawLine = function(wayId, direction) { mode.exit = function() { mode.map.hint(false); - mode.map.fastEnable(true); + mode.map.fastEnable(true) + .hoverEnable(true); mode.map.surface .on('mousemove.drawline', null) diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 60cfad861..66727cd06 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -12,6 +12,7 @@ iD.Map = function() { .scaleExtent([1024, 256 * Math.pow(2, 24)]) .on('zoom', zoomPan), dblclickEnabled = true, + hoverEnabled = true, fastEnabled = true, notice, background = iD.Background() @@ -265,6 +266,7 @@ iD.Map = function() { } function hoverIn() { + if (!hoverEnabled) return; var datum = d3.select(d3.event.target).datum(); if (datum instanceof iD.Entity) { hover = datum.id; @@ -274,7 +276,7 @@ iD.Map = function() { } function hoverOut() { - if (hover) { + if (hoverEnabled && hover) { var oldHover = hover; hover = null; redraw([oldHover]); @@ -350,6 +352,12 @@ iD.Map = function() { return map; }; + map.hoverEnable = function(_) { + if (!arguments.length) return hoverEnabled; + hoverEnabled = _; + return map; + }; + map.fastEnable = function(_) { if (!arguments.length) return fastEnabled; fastEnabled = _;