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,13 +25,17 @@ 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:
- Fixed two corner-case bugs when drawing filled curves (report and
......
......@@ -91,6 +91,10 @@ $(function () {
}));
});
placeholder.bind("plotunselected", function (event) {
$("#selection").text("");
});
var plot = $.plot(placeholder, data, options);
$("#clearSelection").click(function () {
......
......@@ -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