From 1ca0282c9919da72f2453cdffab5b9039d32e6ef Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 8 Jan 2014 19:26:45 +0200 Subject: [PATCH 1/2] avoid excessive tooltip show/hide with mouseenter/leave --- js/id/behavior/tail.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/id/behavior/tail.js b/js/id/behavior/tail.js index bbc1e569e..c91eab34b 100644 --- a/js/id/behavior/tail.js +++ b/js/id/behavior/tail.js @@ -27,13 +27,13 @@ iD.behavior.Tail = function() { ~~d3.event.clientY + 'px)'); } - function mouseout() { + function mouseleave() { if (d3.event.relatedTarget !== container.node()) { container.style('display', 'none'); } } - function mouseover() { + function mouseenter() { if (d3.event.relatedTarget !== container.node()) { show(); } @@ -49,8 +49,8 @@ iD.behavior.Tail = function() { selection .on('mousemove.tail', mousemove) - .on('mouseover.tail', mouseover) - .on('mouseout.tail', mouseout); + .on('mouseenter.tail', mouseenter) + .on('mouseleave.tail', mouseleave); container .on('mousemove.tail', mousemove); @@ -68,8 +68,8 @@ iD.behavior.Tail = function() { selection .on('mousemove.tail', null) - .on('mouseover.tail', null) - .on('mouseout.tail', null); + .on('mouseenter.tail', null) + .on('mouseleave.tail', null); d3.select(window) .on('resize.tail', null); From 92e9b0cbbbdb8d2c000ef19373ef52e94aeae342 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Wed, 8 Jan 2014 19:28:45 +0200 Subject: [PATCH 2/2] throttle hover for less epileptic experience and better perf Otherwise the sidebar flashes so fast that it makes no sense while distracting the user and lagging due to heavy sidebar construction. --- js/id/ui/sidebar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/id/ui/sidebar.js b/js/id/ui/sidebar.js index b3c7294d1..08c46dbc0 100644 --- a/js/id/ui/sidebar.js +++ b/js/id/ui/sidebar.js @@ -32,6 +32,8 @@ iD.ui.Sidebar = function(context) { } }; + sidebar.hover = _.throttle(sidebar.hover, 200); + sidebar.select = function(id, newFeature) { if (!current && id) { featureListWrap.classed('inspector-hidden', true);