diff --git a/js/id/renderer/map.js b/js/id/renderer/map.js index 431282fa9..2b98c491a 100644 --- a/js/id/renderer/map.js +++ b/js/id/renderer/map.js @@ -338,7 +338,12 @@ iD.Map = function() { } map.mouseCoordinates = function() { - return projection.invert(d3.mouse(surface.node())); + try { + return projection.invert(d3.mouse(surface.node())); + } catch(e) { + // when called with hidden elements, d3.mouse() will throw + return [NaN, NaN]; + } }; map.dblclickEnable = function(_) {