1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-29 18:52:13 +01:00

Mouse scroll wheel fix for MenuScroller

This commit is contained in:
Federico Fissore 2013-10-17 16:58:56 +02:00
parent 1877703920
commit 4a47eef28a

View File

@ -470,9 +470,18 @@ public class MenuScroller {
}
private void refreshMenu() {
if (menuItems != null && menuItems.length > 0) {
firstIndex = Math.max(topFixedCount, firstIndex);
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
if (menuItems == null || menuItems.length == 0) {
return;
}
int newFirstIndex = Math.max(topFixedCount, firstIndex);
newFirstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, newFirstIndex);
if (newFirstIndex < 0) {
return;
}
firstIndex = newFirstIndex;
upItem.setEnabled(firstIndex > topFixedCount);
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
@ -502,7 +511,6 @@ public class MenuScroller {
parent.revalidate();
parent.repaint();
}
}
private class MouseScrollListener implements MouseWheelListener {
public void mouseWheelMoved(MouseWheelEvent mwe) {