Example usage for javafx.scene Node localToScene

List of usage examples for javafx.scene Node localToScene

Introduction

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

Prototype

public Bounds localToScene(Bounds localBounds, boolean rootScene) 

Source Link

Document

Transforms a bounds from the local coordinate space of this Node into the coordinate space of its scene.

Usage

From source file:Main.java

public void placeMarker(Node newNode) {
    double nodeMinX = newNode.getLayoutBounds().getMinX();
    double nodeMinY = newNode.getLayoutBounds().getMinY();
    Point2D nodeInScene = newNode.localToScene(nodeMinX, nodeMinY);
    Point2D nodeInMarkerLocal = marker.sceneToLocal(nodeInScene);
    Point2D nodeInMarkerParent = marker.localToParent(nodeInMarkerLocal);

    marker.relocate(nodeInMarkerParent.getX() + marker.getLayoutBounds().getMinX(),
            nodeInMarkerParent.getY() + marker.getLayoutBounds().getMinY());
}