Search in sources :

Example 1 with NUIMouseWheelEvent

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

the class NUIManagerInternal method mouseWheelEvent.

// mouse wheel events
@ReceiveEvent(components = ClientComponent.class, priority = EventPriority.PRIORITY_HIGH)
public void mouseWheelEvent(MouseWheelEvent event, EntityRef entity) {
    if (!mouse.isVisible()) {
        return;
    }
    Vector2i mousePosition = event.getMousePosition();
    if (focus != null) {
        NUIMouseWheelEvent nuiEvent = new NUIMouseWheelEvent(mouse, keyboard, mousePosition, event.getWheelTurns());
        focus.onMouseWheelEvent(nuiEvent);
        if (nuiEvent.isConsumed()) {
            event.consume();
            return;
        }
    }
    if (canvas.processMouseWheel(event.getWheelTurns(), mousePosition)) {
        event.consume();
    }
    if (isReleasingMouse()) {
        event.consume();
    }
}
Also used : NUIMouseWheelEvent(org.terasology.nui.events.NUIMouseWheelEvent) Vector2i(org.joml.Vector2i) ReceiveEvent(org.terasology.engine.entitySystem.event.ReceiveEvent)

Aggregations

Vector2i (org.joml.Vector2i)1 ReceiveEvent (org.terasology.engine.entitySystem.event.ReceiveEvent)1 NUIMouseWheelEvent (org.terasology.nui.events.NUIMouseWheelEvent)1