Scroll Wheel in Lemur

Well, taking a look to the code, I can see that the MouseMotionEvent is always triggered with 0’s in the BasePickState (and there is no other appState throwing mouse events on lemur). The code (in PickEventSession) looks always like:

// MouseMotionEvent(int x, int y, int dx, int dy, int wheel, int deltaWheel)
event = new MouseMotionEvent((int)cursor.x, (int)cursor.y, 0, 0, 0, 0);

The methods firing this events are all submitted by a MouseObserver, which is defined in MouseAppState (extending BasePickState). The strange thing here is that the JME’s MouseMotionEvent is being ignored (commented) and motion is being handled with JME’s MouseButtonEvent. The code is as follows:

    @Override
    protected void dispatchMotion() {
        Vector2f cursor = getApplication().getInputManager().getCursorPosition();
        getSession().cursorMoved((int)cursor.x, (int)cursor.y);
    }

    protected void dispatch(MouseButtonEvent evt) {
        if( getSession().buttonEvent(evt.getButtonIndex(), evt.getX(), evt.getY(), evt.isPressed()) ) {
            evt.setConsumed();
        }
    }

    protected class MouseObserver extends DefaultRawInputListener {
        @Override
        public void onMouseMotionEvent( MouseMotionEvent evt ) {
            //if( isEnabled() )
            //    dispatch(evt);
        }

        @Override
        public void onMouseButtonEvent( MouseButtonEvent evt ) {
            if( isEnabled() ) {
                dispatch(evt);
            }
        }
    }

Instead, the dispatchMotion method is fired by the update(float) in BasePickState. I’m not fully aware about how the delta is handled for all this stuff (is it being calculated by JME or it is by hardware/driver?. Can be it just be done with an newX - oldX?, but then, how can that be done for the wheel, was it also giving values more than -1, 1? O.o).

So, I suppose the solution to this is coming from an implementation of it more than a fix.

(All this research is also revealing that CursorButtonEvent (the one being viewPort-aware) being fired by PickEventSession is passing the cursor’s x and y without adapting it to the viewPort position, so it would be as easy as subtracting this position to the coord values before passing them) - Problem post.