Commit 70bca219 by Alexander Zobnin

graph(add annotation): Add keybinding for CTRL key

parent d553498a
......@@ -80,9 +80,11 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
}, scope);
appEvents.on('graph-click', (event) => {
// Add event only for selected panel
let thisPanelEvent = event.panel.id === ctrl.panel.id;
// Select time for new annotation
if (ctrl.inAddAnnotationMode) {
if (ctrl.inAddAnnotationMode && thisPanelEvent) {
let timeRange = {
from: event.pos.x,
to: null
......@@ -93,6 +95,22 @@ coreModule.directive('grafanaGraph', function($rootScope, timeSrv) {
}
}, scope);
// Add keybinding for Add Annotation mode
$(document).keydown(onCtrlKeyDown);
$(document).keyup(onCtrlKeyUp);
function onCtrlKeyDown(event) {
if (event.key === 'Control') {
ctrl.inAddAnnotationMode = true;
}
}
function onCtrlKeyUp(event) {
if (event.key === 'Control') {
ctrl.inAddAnnotationMode = false;
}
}
function getLegendHeight(panelHeight) {
if (!panel.legend.show || panel.legend.rightSide) {
return 0;
......
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