Began to add global toolbar
This commit is contained in:
@ -193,6 +193,93 @@ function strFormat(val, significant_digits=13) {
|
||||
return evalue;
|
||||
}
|
||||
|
||||
let dummyCallback = function(){
|
||||
console.log("Dummy callback called");
|
||||
}
|
||||
|
||||
// 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 = {};
|
||||
|
||||
function loadControls(panel){
|
||||
let controlBar = document.createElement("div");
|
||||
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", dummyCallback);
|
||||
|
||||
let zoomInControl = new Control("res/zoom_in.png", "res/zoom_in_blocked.png", "Zoom in", dummyCallback);
|
||||
let zoomOutControl = new Control("res/zoom_out.png", "res/zoom_out_blocked.png", "Zoon out", dummyCallback);
|
||||
let shiftOlderControl = new Control("res/shift_older.png", "res/shift_older_blocked.png", "Shift to older", dummyCallback);
|
||||
let shiftNewerControl = new Control("res/shift_newer.png", "res/shift_newer_blocked.png", "Shift to newer", dummyCallback);
|
||||
|
||||
|
||||
let xyControl = new Control("res/y_direction.png", "res/x_direction.png", "Time<->Y zoom", dummyCallback, dummyCallback);
|
||||
let cursorControl = new Control("res/remove_cursor.png", "res/remove_cursor_blocked.png", "Remove cursor",dummyCallback);
|
||||
let legendsControl = new Control("res/display_legends.png", "res/remove_legends.png", "Legends", dummyCallback, dummyCallback);
|
||||
|
||||
let now = Date.now();
|
||||
let old = now - 1000*3600;
|
||||
let dates = new DatesIndicator(old, now);
|
||||
let liveState = new LiveStateIndicator();
|
||||
|
||||
controlBar.appendChild(jumpControl)
|
||||
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();
|
||||
|
||||
panel.appendChild(dates)
|
||||
panel.appendChild(liveState);
|
||||
liveState.changeToDisable();
|
||||
liveState.style.marginLeft = "auto"; //sticks element to the right
|
||||
dates.style.marginLeft = "auto";
|
||||
|
||||
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(){
|
||||
return controlsMap;
|
||||
}
|
||||
|
||||
return {
|
||||
loadControls: loadControls,
|
||||
getControlsMap: getControlsMap,
|
||||
}
|
||||
})();
|
||||
|
||||
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=[];
|
||||
@ -837,6 +924,7 @@ let graphs = (function (){
|
||||
container.parentNode.querySelector('.panel span').appendChild(zoomMode);
|
||||
}
|
||||
|
||||
// The cross to display "main" panel at the location of the graphs
|
||||
let gotoMainElm = document.createElement('div');
|
||||
gotoMainElm.innerHTML = "×";
|
||||
let currentSwiper = swiper[f];
|
||||
|
Reference in New Issue
Block a user