Search in sources :

Example 1 with AbstractNodeHumanInputEvent

use of com.ait.lienzo.client.core.event.AbstractNodeHumanInputEvent in project lienzo-core by ahome-it.

the class LienzoHandlerManager method doCheckEnterExitShape.

// This will also return the shape under the cursor, for some optimization on Mouse Move
@SuppressWarnings("unchecked")
private final Shape<?> doCheckEnterExitShape(final INodeXYEvent event) {
    final int x = event.getX();
    final int y = event.getY();
    final Shape<?> shape = findShapeAtPoint(x, y);
    if (shape != null) {
        final IPrimitive<?> prim = shape.asPrimitive();
        if (null != m_over_prim) {
            if (prim != m_over_prim) {
                if (m_over_prim.isEventHandled(NodeMouseExitEvent.getType())) {
                    if (event instanceof AbstractNodeHumanInputEvent) {
                        m_over_prim.fireEvent(new NodeMouseExitEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y));
                    } else {
                        m_over_prim.fireEvent(new NodeMouseExitEvent(null, x, y));
                    }
                }
            }
        }
        if (prim != m_over_prim) {
            if ((null != prim) && (prim.isEventHandled(NodeMouseEnterEvent.getType()))) {
                if (event instanceof AbstractNodeHumanInputEvent) {
                    prim.fireEvent(new NodeMouseEnterEvent(((AbstractNodeHumanInputEvent<MouseEvent<?>, ?>) event).getHumanInputEvent(), x, y));
                } else {
                    prim.fireEvent(new NodeMouseEnterEvent(null, x, y));
                }
            }
            m_over_prim = prim;
        }
    } else {
        doCancelEnterExitShape(event);
    }
    return shape;
}
Also used : AbstractNodeHumanInputEvent(com.ait.lienzo.client.core.event.AbstractNodeHumanInputEvent) NodeMouseEnterEvent(com.ait.lienzo.client.core.event.NodeMouseEnterEvent) NodeMouseExitEvent(com.ait.lienzo.client.core.event.NodeMouseExitEvent) TouchPoint(com.ait.lienzo.client.core.event.TouchPoint)

Aggregations

AbstractNodeHumanInputEvent (com.ait.lienzo.client.core.event.AbstractNodeHumanInputEvent)1 NodeMouseEnterEvent (com.ait.lienzo.client.core.event.NodeMouseEnterEvent)1 NodeMouseExitEvent (com.ait.lienzo.client.core.event.NodeMouseExitEvent)1 TouchPoint (com.ait.lienzo.client.core.event.TouchPoint)1