Example usage for javafx.scene Node contains

List of usage examples for javafx.scene Node contains

Introduction

In this page you can find the example usage for javafx.scene Node contains.

Prototype

public boolean contains(Point2D localPoint) 

Source Link

Document

Returns true if the given point (specified in the local coordinate space of this Node ) is contained within the shape of this Node .

Usage

From source file:com.eviware.loadui.ui.fx.util.NodeUtils.java

public static Node findFrontNodeAtCoordinate(Node root, Point2D point, Node... ignored) {
    if (!root.contains(root.sceneToLocal(point)) || !root.isVisible()) {
        return null;
    }// w  w w . j ava 2s  .  c  o m

    for (Node ignore : ignored) {
        if (isDescendant(ignore, root)) {
            return null;
        }
    }

    if (root instanceof Parent) {
        List<Node> children = ((Parent) root).getChildrenUnmodifiable();
        for (int i = children.size() - 1; i >= 0; i--) {
            Node result = findFrontNodeAtCoordinate(children.get(i), point, ignored);
            if (result != null) {
                return result;
            }
        }
    }

    return root;
}