-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmenuBar.js
51 lines (36 loc) · 1.45 KB
/
menuBar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const blurLayer = document.getElementById("blurLayer");
blurLayer.addEventListener('click', function (ev) {
if (ev.composedPath()[0] === this) {
toggleBlurVisibility();
}
});
function toggleBlurVisibility() {
if (blurLayer.style.display === "none") {
blurLayer.style.display = "flex";
} else {
blurLayer.style.display = "none";
}
}
function makeVisible(element) {
element.style.display = "inherit";
}
function hide(element) {
element.style.display = "none";
}
const addFeatureMenuButton = document.getElementById("addFeatureMenuButton");
const settingsMenuButton = document.getElementById("settingsMenuButton");
const parametersMenuButton = document.getElementById("parametersMenuButton");
const addFeatureMenuCard = document.getElementById("addFeatureMenuCard");
const settingsMenuCard = document.getElementById("settingsMenuCard");
const parametersMenuCard = document.getElementById("parametersMenuCard");
addFeatureMenuButton.addEventListener('click', () => onClickTopMenu(addFeatureMenuCard));
settingsMenuButton.addEventListener('click', () => onClickTopMenu(settingsMenuCard));
parametersMenuButton.addEventListener('click', () => onClickTopMenu(parametersMenuCard));
const menuObjects = [addFeatureMenuCard, settingsMenuCard, parametersMenuCard];
function onClickTopMenu(element) {
menuObjects.forEach((el) => {
hide(el);
});
blurLayer.style.display = "flex";
makeVisible(element);
}