Commit 7ad299e7 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

allow scrollbar navigation for the menu, and factor in the window's scrollbar

height from the maximum menu height
parent 5bfda305
......@@ -555,7 +555,19 @@ var canvas_events = (function() {
}
},
dropdown_menu_mousedown: function(evt) {
var select_elem = document.querySelector("#dropdown_list");
var select_elem = document.querySelector("#dropdown_list"),
in_dropdown = evt.target;
while (in_dropdown) {
if (in_dropdown.id === "dropdown_list") {
break;
}
in_dropdown = in_dropdown.parentNode;
}
if (in_dropdown &&
evt.pageX - select_elem.offsetLeft >
select_elem.clientWidth) {
return;
}
if (evt.target.parentNode
&& evt.target.parentNode.parentNode
&& evt.target.parentNode.parentNode.id === "dropdown_list") {
......
......@@ -4609,9 +4609,16 @@ function gui_dropdown_activate(cid, obj_tag, tag, current_index, font_size, stat
.window.document.querySelector("#dropdown_list");
// stick the obj_tag in a data field
select_elem.setAttribute("data-callback", obj_tag);
// set the maximum height of the menu to be the remaining
// space below the corresponding widget, minus the size of
// the scrollbar. (innerHeight includes scrollbar, and
// the documentElement's clientHeight (apparently) does not.
select_elem.style.setProperty("max-height",
(patchwin[cid].window.innerHeight -
g.getBoundingClientRect().bottom - 5) + "px"
g.getBoundingClientRect().bottom -
(patchwin[cid].window.innerHeight -
patchwin[cid].window.document.documentElement.clientHeight))
+ "px"
);
select_elem.style.setProperty("display", "inline");
select_elem.style.setProperty("left",
......
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