Source
* actual data point and adds N pixels to all sides. Then looks if mouse is in calculated area. N is calculated by
/*
** Zabbix
** Copyright (C) 2001-2024 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/**
* JQuery class that initializes interactivity for SVG graph.
*
* Supported options:
* - SBox - time range selector;
* - show_problems - show problems in hintbox when mouse is moved over the problem zone;
* - min_period - min period in seconds that must be s-boxed to change the data in dashboard timeselector.
*/
(function ($) {
"use strict";
// Makes SBox selection cancelable pressing Esc.
function sBoxKeyboardInteraction(e) {
if (e.keyCode == 27) {
destroySBox(e, e.data.graph);
}
}
// Disable text selection in document when move mouse pressed cursor.
function disableSelect(e) {
e.preventDefault();
}
// Cancel SBox and unset its variables.
function destroySBox(e, graph) {
var graph = graph || e.data.graph,
data = graph.data('options');
if (data) {
if (!data.isHintBoxFrozen && !data.isTriggerHintBoxFrozen) {
graph.data('widget')._resumeUpdating();
}
jQuery('.svg-graph-selection', graph).attr({'width': 0, 'height': 0});
jQuery('.svg-graph-selection-text', graph).text('');
graph.data('options').boxing = false;
}
dropDocumentListeners(e, graph);
}
/**
* Function removes SBox related $(document) event listeners: