From 2f818087f7159e38d11f4c00b814fda96fb3a275 Mon Sep 17 00:00:00 2001
From: Jonathan Wilkes <jon.w.wilkes@gmail.com>
Date: Sat, 24 Jun 2017 00:51:00 -0400
Subject: [PATCH] add event to handle scrolling the menu with the mousewheel

---
 pd/nw/pd_canvas.js | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/pd/nw/pd_canvas.js b/pd/nw/pd_canvas.js
index a93120169..e9771d8db 100644
--- a/pd/nw/pd_canvas.js
+++ b/pd/nw/pd_canvas.js
@@ -625,6 +625,9 @@ var canvas_events = (function() {
             },
             dropdown_menu_mouseup: function(evt) {
                 var i, select_elem;
+                // This can be triggered if the user keeps the mouse down
+                // to highlight an element and releases the mouse button to
+                // choose that element
                 if (evt.target.parentNode
                     && evt.target.parentNode.parentNode
                     && evt.target.parentNode.parentNode.id === "dropdown_list") {
@@ -634,6 +637,13 @@ var canvas_events = (function() {
                     canvas_events.normal();
                 }
             },
+            dropdown_menu_wheel: function(evt) {
+                // Here we generate bogus mouse coords so that
+                // we can break through the filter below if we're
+                // using the mouse wheel to scroll in the list.
+                last_dropdown_menu_x = Number.MIN_VALUE;
+                last_dropdown_menu_y = Number.MIN_VALUE;
+            },
             dropdown_menu_mousemove: function(evt) {
                 // For whatever reason, Chromium decides to trigger the
                 // mousemove/mouseenter/mouseover events if the element
@@ -913,6 +923,8 @@ var canvas_events = (function() {
             document.addEventListener("mousemove", events.dropdown_menu_mousemove, false);
             document.addEventListener("keydown", events.dropdown_menu_keydown, false);
             document.addEventListener("keypress", events.dropdown_menu_keypress, false);
+            document.querySelector("#dropdown_list")
+                .addEventListener("wheel", events.dropdown_menu_wheel, false);
         },
         search: function() {
             this.none();
-- 
GitLab