@ 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 ; }
This will also return the shape under the cursor for some optimization on Mouse Move