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 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 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 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 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 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
|
let type = 'linear'; // type of graphs axis to display
|
||||||
|
|
||||||
@ -701,9 +703,13 @@ let graphs = (function (){
|
|||||||
legendFlag = true;
|
legendFlag = true;
|
||||||
let trect = evt.target.getBoundingClientRect();
|
let trect = evt.target.getBoundingClientRect();
|
||||||
let X = evt.clientX - trect.x, Y = evt.clientY - trect.y;
|
let X = evt.clientX - trect.x, Y = evt.clientY - trect.y;
|
||||||
|
if (X == cursorLinePos) {
|
||||||
|
cursorLine(null);
|
||||||
|
} else {
|
||||||
menuGraphicsPopup.hide();
|
menuGraphicsPopup.hide();
|
||||||
showLegends(true, false);
|
showLegends(true, false);
|
||||||
cursorLine(X);
|
cursorLine(X);
|
||||||
|
}
|
||||||
setLiveMode();
|
setLiveMode();
|
||||||
update();
|
update();
|
||||||
for (let gr of graph_array.slice(0, ngraphs)) {
|
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
|
* Sets (overwrite) the data (curve) of the given variable
|
||||||
@ -926,6 +943,7 @@ let graphs = (function (){
|
|||||||
function panCallback(graph){
|
function panCallback(graph){
|
||||||
let ax = graph.chart.options.scales.x;
|
let ax = graph.chart.options.scales.x;
|
||||||
let xmin = ax.min, xmax = ax.max;
|
let xmin = ax.min, xmax = ax.max;
|
||||||
|
clickMode = 2; // mouse pan mode
|
||||||
if (liveMode && xmax < lastTime) setLiveMode(false);
|
if (liveMode && xmax < lastTime) setLiveMode(false);
|
||||||
setMinMax(xmin,xmax);
|
setMinMax(xmin,xmax);
|
||||||
update();
|
update();
|
||||||
|
Reference in New Issue
Block a user