mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-17 22:23:10 +03:00
Mouse scroll wheel fix for MenuScroller
This commit is contained in:
@ -470,9 +470,18 @@ public class MenuScroller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshMenu() {
|
private void refreshMenu() {
|
||||||
if (menuItems != null && menuItems.length > 0) {
|
if (menuItems == null || menuItems.length == 0) {
|
||||||
firstIndex = Math.max(topFixedCount, firstIndex);
|
return;
|
||||||
firstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, firstIndex);
|
}
|
||||||
|
|
||||||
|
int newFirstIndex = Math.max(topFixedCount, firstIndex);
|
||||||
|
newFirstIndex = Math.min(menuItems.length - bottomFixedCount - scrollCount, newFirstIndex);
|
||||||
|
|
||||||
|
if (newFirstIndex < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
firstIndex = newFirstIndex;
|
||||||
|
|
||||||
upItem.setEnabled(firstIndex > topFixedCount);
|
upItem.setEnabled(firstIndex > topFixedCount);
|
||||||
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
|
downItem.setEnabled(firstIndex + scrollCount < menuItems.length - bottomFixedCount);
|
||||||
@ -502,7 +511,6 @@ public class MenuScroller {
|
|||||||
parent.revalidate();
|
parent.revalidate();
|
||||||
parent.repaint();
|
parent.repaint();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private class MouseScrollListener implements MouseWheelListener {
|
private class MouseScrollListener implements MouseWheelListener {
|
||||||
public void mouseWheelMoved(MouseWheelEvent mwe) {
|
public void mouseWheelMoved(MouseWheelEvent mwe) {
|
||||||
|
Reference in New Issue
Block a user