graph(add annotation): refactor

pass ctrlKey and metaKey through flot events
This commit is contained in:
Alexander Zobnin
2017-04-12 15:26:34 +03:00
parent f42202e665
commit 232513bb4e
3 changed files with 14 additions and 21 deletions

View File

@@ -2972,6 +2972,10 @@ Licensed under the MIT license.
pos.pageX = event.pageX;
pos.pageY = event.pageY;
// Add ctrlKey and metaKey to event
pos.ctrlKey = event.ctrlKey;
pos.metaKey = event.metaKey;
var item = findNearbyItem(canvasX, canvasY, seriesFilter);
if (item) {

View File

@@ -145,7 +145,7 @@ The plugin allso adds the following methods to the plot object:
updateSelection(e);
if (selectionIsSane())
triggerSelectedEvent();
triggerSelectedEvent(e);
else {
// this counts as a clear
plot.getPlaceholder().trigger("plotunselected", [ ]);
@@ -180,9 +180,13 @@ The plugin allso adds the following methods to the plot object:
return r;
}
function triggerSelectedEvent() {
function triggerSelectedEvent(event) {
var r = getSelection();
// Add ctrlKey and metaKey to event
r.ctrlKey = event.ctrlKey;
r.metaKey = event.metaKey;
plot.getPlaceholder().trigger("plotselected", [ r ]);
// backwards-compat stuff, to be removed in future