Commit 228f5059 authored by Téo Vasseur's avatar Téo Vasseur

js : ctrl + click instead of dblclick for edit mode

parent 148d2ed5
......@@ -52,30 +52,39 @@ function viewSelector(view) {
}
function viewSetter(view) {
var f = function() {setView(view)};
var f = function(e) {
if (e.ctrlKey) {
hideOverlays();
$(".overlay").show();
selectedView = view;
focus(e.target);
} else {
setView(view);
}
};
return f;
}
function focus(target) {
target.className += " focused";
var listener = function() {
hideOverlays();
target.removeEventListener('click', listener);
};
target.addEventListener('click', listener);
}
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.ondblclick = viewSelector(views[i]);
div.addEventListener('dblclick', focus);
// div.addEventListener('dblclick', focus);
menu.appendChild(div);
}
......
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