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 {
border: solid;
}
.focused {
background-color: lightblue;
}
#panels {
display: grid;
position: fixed;
......
......@@ -38,7 +38,8 @@ function setView(view, parentId) {
}
function viewSelector(view) {
var f = function () {
var f = function() {
hideOverlays();
$(".overlay").show();
selectedView = view;
}
......@@ -56,18 +57,30 @@ function setMenuOptions() {
var menu = document.getElementById("menu");
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) {
div = document.createElement('div');
div.textContent = views[i].id;
div.onclick = viewSetter(views[i]);
div.ondblclick = viewSelector(views[i]);
div.addEventListener('dblclick', focus);
menu.appendChild(div);
}
}
function hideOverlays() {
$(".overlay").hide();
$(".focused").removeClass("focused");
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