Removed useless controls + changed controls style

This commit is contained in:
l_samenv
2024-08-09 10:54:28 +02:00
parent 62d1047925
commit 9c7fe9d622
6 changed files with 12 additions and 52 deletions

View File

@ -199,18 +199,9 @@ let dummyCallback = function(){
// Defining keys for global controls
let jumpKey = "jump-control";
let goToNowKey = "go-to-now-control";
let zoomInKey = "zoom-in-control";
let zoomOutKey = "zoom-out-control";
let shiftOlderKey = "shift-older-control";
let shiftNewerKey = "shift-newer-control";
let xyKey = "xy-control";
let cursorKey = "cursor-control";
let legendsKey = "legends-control";
let globalControls = (function (){
let controlsMap = {};
@ -220,43 +211,17 @@ let globalControls = (function (){
controlBar.id = "control_bar";
panel.appendChild(controlBar);
let jumpControl = new Control("res/jump.png", "res/jump_blocked.png", "Jump", dummyCallback);
let goToNowControl = new Control("res/go_to_now.png", "res/go_to_now_blocked.png", "Go to now", graphs.gotoNow);
let goToNowControl = new Control("res/go_to_now_white.png", "res/go_to_now_blocked.png", "Go to now", graphs.gotoNow);
let zoomInControl = new Control("res/zoom_in.png", "res/zoom_in_blocked.png", "Zoom in (time)", graphs.zoomIn);
let zoomOutControl = new Control("res/zoom_out.png", "res/zoom_out_blocked.png", "Zoon out (time)", graphs.zoomOut);
let shiftOlderControl = new Control("res/shift_older.png", "res/shift_older_blocked.png", "Shift to older", graphs.shiftOlder);
let shiftNewerControl = new Control("res/shift_newer.png", "res/shift_newer_blocked.png", "Shift to newer", graphs.shiftNewer);
let xyControl = new Control("res/y_direction.png", "res/x_direction.png", "Time<->Y zoom (one graph)", graphs.toggleZoomMode, graphs.toggleZoomMode);
let cursorControl = new Control("res/remove_cursor.png", "res/remove_cursor_blocked.png", "Remove cursor", graphs.removeCursor);
let legendsControl = new Control("res/display_legends.png", "res/remove_legends.png", "Legends", graphs.displayAllLegends, graphs.hideAllLegends);
controlBar.appendChild(jumpControl)
let xyControl = new Control("res/x_zoom_white.png", "res/y_zoom_white.png", "Time<->Y zoom (one graph)", graphs.toggleZoomMode, graphs.toggleZoomMode);
controlBar.appendChild(goToNowControl)
goToNowControl.changeToAlt();
controlBar.appendChild(new VerticalDivider());
controlBar.appendChild(zoomInControl);
controlBar.appendChild(zoomOutControl);
controlBar.appendChild(shiftOlderControl);
controlBar.appendChild(shiftNewerControl);
controlBar.appendChild(new VerticalDivider());
controlBar.appendChild(xyControl);
controlBar.appendChild(cursorControl);
cursorControl.changeToAlt();
controlBar.appendChild(legendsControl);
legendsControl.changeToAlt();
controlsMap[jumpKey] = jumpControl;
controlsMap[goToNowKey] = goToNowControl;
controlsMap[zoomInKey] = zoomInControl;
controlsMap[zoomOutKey] = zoomOutControl;
controlsMap[shiftOlderKey] = shiftOlderControl;
controlsMap[shiftNewerKey] = shiftNewerControl;
controlsMap[xyKey] = xyControl;
controlsMap[cursorKey] = cursorControl;
controlsMap[legendsKey] = legendsControl;
}
function getControlsMap(){
@ -907,7 +872,6 @@ let graphs = (function (){
*/
function gotoNow() {
cursorLine(null);
globalControls.getControlsMap()[cursorKey].changeToAlt();
if (!liveMode) {
setMinMax(graphs.now() - (currentMaxTime - currentMinTime), graphs.now());
}
@ -1065,7 +1029,6 @@ let graphs = (function (){
function removeCursor(evt=null) {
graphs.cursorLine(null);
globalControls.getControlsMap()[cursorKey].changeToAlt();
graphs.update();
}
@ -1106,12 +1069,10 @@ let graphs = (function (){
function displayAllLegends(){
showLegends(true, false);
globalControls.getControlsMap()[legendsKey].changeToAlt();
}
function hideAllLegends(){
showLegends(false, false);
globalControls.getControlsMap()[legendsKey].changeToMain();
}
/**
@ -1213,7 +1174,6 @@ let graphs = (function (){
cursorElement.style.display = 'block';
cursorElement.style.left = (cursorLinePos - 1) + 'px';
cursorElement.style.height = window.innerHeight + 'px';
globalControls.getControlsMap()[cursorKey].changeToMain();
}
return cursorLinePos;
}
@ -1628,7 +1588,6 @@ function Graph(gindex, container, x_label, y_label, tag, scaleType = "linear"){
} else {
graphs.cursorLine(null);
legend.style.display = 'none';
globalControls.getControlsMap()[legendsKey].changeToMain();
}
}