Skip to content

Commit 4421e02

Browse files
committed
OnMouseWheel EventHandler
Window now supports the mouse wheel event
1 parent 362edb0 commit 4421e02

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/studios/vanish/engine/Window.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public void paintComponent(Graphics g)
4141
public EventHandler OnMouseLeave = new EventHandler();
4242
public EventHandler OnMouseClick = new EventHandler();
4343
public EventHandler OnMouseDrag = new EventHandler();
44+
public EventHandler OnMouseWheel = new EventHandler();
4445
public EventHandler OnShow = new EventHandler();
4546
public EventHandler OnClose = new EventHandler();
4647
public EventHandler OnFocus = new EventHandler();
@@ -209,6 +210,13 @@ public void mouseReleased(MouseEvent e)
209210
OnMouseUp.InvokeAll(new Point(e.getX(), e.getY()), e.getButton());
210211
}
211212
});
213+
container.addMouseWheelListener(new MouseWheelListener()
214+
{
215+
public void mouseWheelMoved(MouseWheelEvent e)
216+
{
217+
OnMouseWheel.InvokeAll(e.getScrollAmount() * e.getWheelRotation());
218+
}
219+
});
212220
container.addMouseMotionListener(new MouseMotionListener()
213221
{
214222
public void mouseDragged(MouseEvent e)

0 commit comments

Comments
 (0)