Commit da43cef6 authored by olau@iola.dk's avatar olau@iola.dk

Added "plotunselected" event

git-svn-id: https://flot.googlecode.com/svn/trunk@130 1e0a6537-2640-0410-bfb7-f154510ff394
parent 8a78e8f8
......@@ -621,6 +621,9 @@ making the selection. A "plotselecting" event is fired during the
process with the same parameters as the "plotselected" event, in case
you want to know what's happening while it's happening,
A "plotunselected" event with no arguments is emitted when the user
clicks the mouse to remove the selection.
Customizing the crosshair
=========================
......@@ -676,9 +679,10 @@ can call:
"plotselected" handler, pass true as the second parameter.
- clearSelection()
- clearSelection(preventEvent)
Clear the selection rectangle.
Clear the selection rectangle. Pass in true to avoid getting a
"plotunselected" event.
- setCrosshair(pos)
......
......@@ -25,12 +25,16 @@ Changes:
$.plot.formatDate(...) (suggestion by Matt Manela) and even
replaced.
- Added "borderColor" option to the grid (patch from Amaury Chamayoau
- Added "borderColor" option to the grid (patch from Amaury Chamayou
and patch from Mike R. Williamson).
- Added support for gradient background for the grid, take a look at
the "setting options" example (based on patch from Amaury Chamayou,
issue 90).
- Added a "plotunselected" event which is triggered when the selection
is removed, see "selection" example (suggestion by Meda Ugo);
Bug fixes:
......
......@@ -90,6 +90,10 @@ $(function () {
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
}));
});
placeholder.bind("plotunselected", function (event) {
$("#selection").text("");
});
var plot = $.plot(placeholder, data, options);
......
......@@ -1934,9 +1934,11 @@
triggerSelectedEvent();
clickIsMouseUp = true;
}
else
else {
// this counts as a clear
target.trigger("plotunselected", [ ]);
target.trigger("plotselecting", [ null ]);
}
return false;
}
......@@ -1969,13 +1971,15 @@
triggerRedrawOverlay();
}
else
clearSelection();
clearSelection(true);
}
function clearSelection() {
function clearSelection(preventEvent) {
if (selection.show) {
selection.show = false;
triggerRedrawOverlay();
if (!preventEvent)
target.trigger("plotunselected", [ ]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment