How can I get the Element under the mouse cursor?

Hi!

How do I get the Element under the cursor? That looks to be what e.g. getContactElement does, but it is private.

@tuffe said: Hi!

How do I get the Element under the cursor? That looks to be what e.g. getContactElement does, but it is private.

A couple ways you can do this…


// This actually returns the current mouse focus element
screen.getToolTipFocus();

or


Geometry geom = screen.getLastCollision();
Node n = geom.getParent();
if (n instanceof Element) { 
// do stuff
}