From 54ce0b2e75805c6c14047b9af720f7a2f4174252 Mon Sep 17 00:00:00 2001 From: Nick Campbell Date: Thu, 1 Nov 2012 17:38:12 -0400 Subject: [PATCH] !selection.show => return null from getSelection If we've called `clearSelection`, then calling `getSelection` shouldn't return the old selection values. When calling `getSelection` before a selection is made, `null` is returned. It seemed appropriate to do the same if `selection.show` was falsy. Signed-off-by: Nick Campbell --- jquery.flot.selection.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jquery.flot.selection.js b/jquery.flot.selection.js index 7f7b326..f34b84b 100644 --- a/jquery.flot.selection.js +++ b/jquery.flot.selection.js @@ -146,6 +146,8 @@ The plugin allso adds the following methods to the plot object: function getSelection() { if (!selectionIsSane()) return null; + + if (!selection.show) return null; var r = {}, c1 = selection.first, c2 = selection.second; $.each(plot.getAxes(), function (name, axis) {