From bcf9df2fff2bd70cc86e7c68580c5fd4c04b83c5 Mon Sep 17 00:00:00 2001 From: "olau@iola.dk" Date: Tue, 14 Dec 2010 19:24:25 +0000 Subject: [PATCH] Listen for mouseleave events and fire a plothover event with empty item when it occurs git-svn-id: https://flot.googlecode.com/svn/trunk@281 1e0a6537-2640-0410-bfb7-f154510ff394 --- NEWS.txt | 7 +++++-- jquery.flot.js | 10 +++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/NEWS.txt b/NEWS.txt index 3312df1..fdbeddd 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -103,11 +103,14 @@ Bug fixes: - Fix errors in JSON in examples so they work with jQuery 1.4.2 (fix reported by honestbleeps, issue 357). - Fix bug with tooltip in interacting.html, this makes the tooltip - much smoother (fix by bdkahn). + much smoother (fix by bdkahn). Fix related bug inside highlighting + handler in Flot. - Use closure trick to make inline colorhelpers plugin respect jQuery.noConflict(true), renaming the global jQuery object (reported by Nick Stielau). - +- Listen for mouseleave events and fire a plothover event with empty + item when it occurs to drop highlights when the mouse leaves the + plot (reported by by outspirit). Flot 0.6 -------- diff --git a/jquery.flot.js b/jquery.flot.js index 3afa467..c499d26 100644 --- a/jquery.flot.js +++ b/jquery.flot.js @@ -740,8 +740,10 @@ eventHolder = $([overlay, canvas]); // bind events - if (options.grid.hoverable) + if (options.grid.hoverable) { eventHolder.mousemove(onMouseMove); + eventHolder.mouseleave(onMouseLeave); + } if (options.grid.clickable) eventHolder.click(onClick); @@ -2271,6 +2273,12 @@ function (s) { return s["hoverable"] != false; }); } + function onMouseLeave(e) { + if (options.grid.hoverable) + triggerClickHoverEvent("plothover", e, + function (s) { return false; }); + } + function onClick(e) { triggerClickHoverEvent("plotclick", e, function (s) { return s["clickable"] != false; });