fix setting cursor when clicked
cursor should not be set when dragging (pan)
This commit is contained in:
@ -395,9 +395,11 @@ function loadCurvesSettingsPopup(){
|
||||
let graphs = (function (){
|
||||
let dataset_to_graph_map = {}; // a dictionnary mapping a variable name to a two values array, containing its graph index and its position inside the graph
|
||||
let blocks, liveMode=true, top_vars=[], bottom_vars=[];
|
||||
let legendFlag = false, currentZoomMode = isTouchDevice ? 'xy' : 'x';
|
||||
let legendFlag = false;
|
||||
let currentZoomMode = isTouchDevice ? 'xy' : 'x';
|
||||
let prevTime = null, prevMin = null, prevMax = null, prevGraph = null; // zoom speed limitation
|
||||
let cursorLinePos = null; // the position of the cursor line (given by its x value)
|
||||
let clickMode = 0; // 1: mouse is down, 2: pan is active, 0: after mouse down
|
||||
|
||||
let type = 'linear'; // type of graphs axis to display
|
||||
|
||||
@ -701,9 +703,13 @@ let graphs = (function (){
|
||||
legendFlag = true;
|
||||
let trect = evt.target.getBoundingClientRect();
|
||||
let X = evt.clientX - trect.x, Y = evt.clientY - trect.y;
|
||||
menuGraphicsPopup.hide();
|
||||
showLegends(true, false);
|
||||
cursorLine(X);
|
||||
if (X == cursorLinePos) {
|
||||
cursorLine(null);
|
||||
} else {
|
||||
menuGraphicsPopup.hide();
|
||||
showLegends(true, false);
|
||||
cursorLine(X);
|
||||
}
|
||||
setLiveMode();
|
||||
update();
|
||||
for (let gr of graph_array.slice(0, ngraphs)) {
|
||||
@ -714,7 +720,18 @@ let graphs = (function (){
|
||||
}
|
||||
}
|
||||
}
|
||||
container.addEventListener('click', clickHandler)
|
||||
function mouseDown(evt) {
|
||||
clickMode = 1;
|
||||
}
|
||||
function mouseUp(evt) {
|
||||
if (clickMode == 1) { // mouse was down, but no pan happend
|
||||
clickHandler(evt);
|
||||
}
|
||||
clickMode = 0;
|
||||
}
|
||||
// container.addEventListener('click', clickHandler)
|
||||
container.addEventListener('mousedown', mouseDown);
|
||||
container.addEventListener('mouseup', mouseUp);
|
||||
|
||||
/**
|
||||
* Sets (overwrite) the data (curve) of the given variable
|
||||
@ -926,6 +943,7 @@ let graphs = (function (){
|
||||
function panCallback(graph){
|
||||
let ax = graph.chart.options.scales.x;
|
||||
let xmin = ax.min, xmax = ax.max;
|
||||
clickMode = 2; // mouse pan mode
|
||||
if (liveMode && xmax < lastTime) setLiveMode(false);
|
||||
setMinMax(xmin,xmax);
|
||||
update();
|
||||
@ -1491,7 +1509,7 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){
|
||||
|
||||
if (gindex != 0) {
|
||||
// show time labels only on first chart
|
||||
chart_options.scales.x.ticks.callback = function () { return ''; }
|
||||
chart_options.scales.x.ticks.callback = function () { return ' '; }
|
||||
}
|
||||
|
||||
chart = new Chart(ctx, {type: 'scatter', options: chart_options})
|
||||
|
Reference in New Issue
Block a user