Close menu when clicking on export, dates and canvas
This commit is contained in:
@ -1,11 +1,13 @@
|
||||
class ActionEntry extends HTMLElement{
|
||||
constructor(title, actionCallback){
|
||||
constructor(title, actionCallback, hideMenuCallback){
|
||||
super();
|
||||
this.title = title;
|
||||
this.actionCallback = actionCallback;
|
||||
this.hideMenuCallback = hideMenuCallback;
|
||||
}
|
||||
|
||||
performActionCallback(){
|
||||
this.hideMenuCallback();
|
||||
this.actionCallback()
|
||||
}
|
||||
|
||||
|
@ -239,6 +239,9 @@ let globalIndicators = (function (){
|
||||
function loadIndicators(panel){
|
||||
let leftDate = Date.now() - 30*60*1000;
|
||||
let datesIndicator = new DateIndicator(leftDate, graphs.gotoNow, graphs.jumpToDate);
|
||||
datesIndicator.addEventListener("click", function () {
|
||||
menuGraphicsPopup.hide()
|
||||
})
|
||||
|
||||
panel.appendChild(datesIndicator);
|
||||
datesIndicator.style.marginLeft = "auto";
|
||||
@ -258,10 +261,12 @@ let globalIndicators = (function (){
|
||||
|
||||
})()
|
||||
|
||||
let menuGraphicsPopup = undefined;
|
||||
|
||||
function loadGraphicsMenu(panel){
|
||||
|
||||
let menuGraphicsPopup = new MenuPopup();
|
||||
let exportActionEntry = new ActionEntry("Export", graphs.displayExportPopup);
|
||||
menuGraphicsPopup = new MenuPopup();
|
||||
let exportActionEntry = new ActionEntry("Export", graphs.displayExportPopup, () => {menuGraphicsPopup.hide()});
|
||||
let removeCursorHelpEntry = new HelpEntry("How to remove the cursor", "You can double click/tap on any graph.");
|
||||
menuGraphicsPopup.addEntry(exportActionEntry)
|
||||
menuGraphicsPopup.addHorizontalDivider();
|
||||
@ -605,6 +610,7 @@ 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);
|
||||
setLiveMode();
|
||||
|
Reference in New Issue
Block a user