Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wynn
purr-data
Commits
7ad299e7
Commit
7ad299e7
authored
Jun 20, 2017
by
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
Changes
2
Show whitespace changes
Inline
Side-by-side
pd/nw/pd_canvas.js
View file @
7ad299e7
...
...
@@ -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
"
)
{
...
...
pd/nw/pdgui.js
View file @
7ad299e7
...
...
@@ -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
"
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment