Java Code Examples for javafx.scene.layout.Pane#sceneToLocal()

The following examples show how to use javafx.scene.layout.Pane#sceneToLocal() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimatedTableRow.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
private void moveDataWithAnimation(final TableView<Person> sourceTable,
		final TableView<Person> destinationTable,
		final Pane commonTableAncestor, final TableRow<Person> row) {
	// Create imageview to display snapshot of row:
	final ImageView imageView = createImageView(row);
	// Start animation at current row:
	final Point2D animationStartPoint = row.localToScene(new Point2D(0, 0)); // relative to Scene
	final Point2D animationEndPoint = computeAnimationEndPoint(destinationTable); // relative to Scene
	// Set start location
	final Point2D startInRoot = commonTableAncestor.sceneToLocal(animationStartPoint); // relative to commonTableAncestor
	imageView.relocate(startInRoot.getX(), startInRoot.getY());
	// Create animation
	final Animation transition = createAndConfigureAnimation(
			sourceTable, destinationTable, commonTableAncestor, row,
			imageView, animationStartPoint, animationEndPoint);
	// add animated image to display
	commonTableAncestor.getChildren().add(imageView);
	// start animation
	transition.play();
}
 
Example 2
Source File: Base3DFileEditor.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
@Override
@FxThread
public boolean isInside(final double sceneX, final double sceneY, @NotNull final Class<? extends Event> eventType) {

    final Pane editorPage = getPage();
    final Pane editor3DPage = get3DArea() == null ? editorPage : get3DArea();

    final boolean only3D = eventType.isAssignableFrom(MouseEvent.class) ||
            eventType.isAssignableFrom(ScrollEvent.class);

    final Pane page = only3D ? editor3DPage : editorPage;

    final Point2D point2D = page.sceneToLocal(sceneX, sceneY);
    return page.contains(point2D);
}