Search in sources :

Example 1 with NUIMouseWheelEvent

use of org.terasology.rendering.nui.events.NUIMouseWheelEvent in project Terasology by MovingBlocks.

the class CanvasImpl method processMouseWheel.

@Override
public boolean processMouseWheel(int wheelTurns, Vector2i pos) {
    for (InteractionRegion next : mouseOverRegions) {
        if (next.region.contains(pos)) {
            Vector2i relPos = new Vector2i(pos);
            relPos.sub(next.region.min());
            if (next.listener.onMouseWheel(new NUIMouseWheelEvent(mouse, keyboard, relPos, wheelTurns))) {
                clickedRegion = next;
                nuiManager.setFocus(next.element);
                return true;
            }
        }
    }
    return false;
}
Also used : NUIMouseWheelEvent(org.terasology.rendering.nui.events.NUIMouseWheelEvent) Vector2i(org.terasology.math.geom.Vector2i) BaseVector2i(org.terasology.math.geom.BaseVector2i)

Aggregations

BaseVector2i (org.terasology.math.geom.BaseVector2i)1 Vector2i (org.terasology.math.geom.Vector2i)1 NUIMouseWheelEvent (org.terasology.rendering.nui.events.NUIMouseWheelEvent)1