mirror of
https://github.com/lovasoa/whitebophir
synced 2024-11-10 06:24:17 +00:00
Merge pull request #194 from sents/dragmenu
Make navigating overflowing menu more accessible
This commit is contained in:
commit
8e90aa3ef7
3 changed files with 26 additions and 4 deletions
|
@ -54,7 +54,6 @@ html, body, svg {
|
||||||
transition-duration: 1s;
|
transition-duration: 1s;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu.closed {
|
#menu.closed {
|
||||||
|
@ -84,7 +83,7 @@ html, body, svg {
|
||||||
}
|
}
|
||||||
|
|
||||||
#settings {
|
#settings {
|
||||||
margin-bottom: 0;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menu .tool {
|
#menu .tool {
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
<div id="loadingMessage">{{translations.loading}}</div>
|
<div id="loadingMessage">{{translations.loading}}</div>
|
||||||
|
|
||||||
<div id="menu" {{#hideMenu}}style="display:none;"{{/hideMenu}}>
|
<div id="menu" tabindex="0" {{#hideMenu}}style="display:none;"{{/hideMenu}}>
|
||||||
<div id="menuItems">
|
<div id="menuItems">
|
||||||
<ul id="tools" class="tools">
|
<ul id="tools" class="tools">
|
||||||
<li class="tool" tabindex="-1">
|
<li class="tool" tabindex="-1">
|
||||||
|
|
|
@ -682,3 +682,26 @@ Tools.svg.height.baseVal.value = document.body.clientHeight;
|
||||||
"stylesheet" : "style.css",
|
"stylesheet" : "style.css",
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
let pos = {top: 0, scroll:0};
|
||||||
|
let menu = document.getElementById("menu");
|
||||||
|
function menu_mousedown(evt) {
|
||||||
|
pos = {
|
||||||
|
top: menu.scrollTop,
|
||||||
|
scroll: evt.clientY
|
||||||
|
}
|
||||||
|
menu.addEventListener("mousemove", menu_mousemove);
|
||||||
|
document.addEventListener("mouseup", menu_mouseup);
|
||||||
|
}
|
||||||
|
function menu_mousemove(evt) {
|
||||||
|
const dy = evt.clientY - pos.scroll;
|
||||||
|
menu.scrollTop = pos.top - dy;
|
||||||
|
}
|
||||||
|
function menu_mouseup(evt) {
|
||||||
|
menu.removeEventListener("mousemove", menu_mousemove);
|
||||||
|
document.removeEventListener("mouseup", menu_mouseup);
|
||||||
|
}
|
||||||
|
menu.addEventListener("mousedown", menu_mousedown);
|
||||||
|
})()
|
||||||
|
|
Loading…
Reference in a new issue