Commit 09627d98 authored by Téo Vasseur's avatar Téo Vasseur

js, css : highlight selectedView in menu, cancel focus

See #2532, #2531
parent aae9fd8f
...@@ -18,6 +18,10 @@ div { ...@@ -18,6 +18,10 @@ div {
border: solid; border: solid;
} }
.focused {
background-color: lightblue;
}
#panels { #panels {
display: grid; display: grid;
position: fixed; position: fixed;
......
...@@ -38,7 +38,8 @@ function setView(view, parentId) { ...@@ -38,7 +38,8 @@ function setView(view, parentId) {
} }
function viewSelector(view) { function viewSelector(view) {
var f = function () { var f = function() {
hideOverlays();
$(".overlay").show(); $(".overlay").show();
selectedView = view; selectedView = view;
} }
...@@ -56,18 +57,30 @@ function setMenuOptions() { ...@@ -56,18 +57,30 @@ function setMenuOptions() {
var menu = document.getElementById("menu"); var menu = document.getElementById("menu");
var div; var div;
var focus = function() {
this.className += " focused";
var listener = function() {
hideOverlays();
this.removeEventListener('click', listener);
};
this.addEventListener('click', listener);
}
for (var i in views) { for (var i in views) {
div = document.createElement('div'); div = document.createElement('div');
div.textContent = views[i].id; div.textContent = views[i].id;
div.onclick = viewSetter(views[i]); div.onclick = viewSetter(views[i]);
div.ondblclick = viewSelector(views[i]); div.ondblclick = viewSelector(views[i]);
div.addEventListener('dblclick', focus);
menu.appendChild(div); menu.appendChild(div);
} }
} }
function hideOverlays() { function hideOverlays() {
$(".overlay").hide(); $(".overlay").hide();
$(".focused").removeClass("focused");
selectedView = undefined; selectedView = undefined;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment