Login  Register

Re: MouseListener, mouseWheelMoved and Shift

Posted by elect on Jan 17, 2014; 4:25pm
URL: https://forum.jogamp.org/MouseListener-mouseWheelMoved-and-Shift-tp4031233p4031247.html

gouessej wrote
Hi

Maybe it would be easier to implement with getButtonsDown().

Edit.: Moreover, wheres AWT has 2 methods returning modifiers (getModifiers() for the states that have just changed, getModifiersEx() with all states), NEWT only has a single getModifiers() method. Don't use +, rather use BUTTON1_DOWN_MASK | BUTTON2_DOWN_MASK but it won't work if NEWT getModifiers() behaves exactly like AWT getModifiers(). In Ardor3D, I only use MouseEvent.getButton(). When you press a mouse button, a new mouse event is generated. If you press the mouse button 1 and then the mouse button 2, 2 mouse (pressed) events are generated. In an high level input system, the current state should already contain the first pressed button when you press the second one.
Exactly, this is the result of me.getModifiers()

press B1     32

press B2     160

release B1  160

press B1     160

This is a pity, why Newt doesn't have both getModifiers() and me.getModifiersEx()?

I will try to use getButtonsDown()[] and MouseEvent.BUTTONx instead. It seems it puts the pressed buttons always in increasing order


Edit: the mouseWheelMoved returns 1 as well

buttons[0] = 1

This is wrong or? Shouldn't it the BUTTON1?

Edit2: if I just scroll the wheel or if I press and hold B1 and then scroll the wheel, this

public void mouseWheelMoved(MouseEvent me) {
        System.out.println("mouseWheelMoved");
       
        System.out.println(me.getModifiers()+" "+me.getButton()+" "+me.getRotation()[1]);
       
        for(int i=0; i<me.getButtonsDown().length;i++){
           
            System.out.println("buttons["+i+"] = "+me.getButtonsDown()[i]);
        }</i>

is returning exactly the same input..

mouseWheelMoved
32 1 1.0
buttons[0] = 1


This is a kind of problem for me, because we would like to have a generic mouseListener, that is if the use wanna change a mouse combination he can.. And if I get the same output I need to modify the mousePressed/Released and make it hardcoded..