public Point2D cellToViewport(C cell, double x, double y) { return cell.getNode().localToParent(x, y); }
public Bounds cellToViewport(C cell, Bounds bounds) { return cell.getNode().localToParent(bounds); }
public Point2D cellToViewport(C cell, Point2D point) { return cell.getNode().localToParent(point); }
/** * Calculates the location relative to the ancestor */ public static Point2D localToAncestor(@Nonnull Node node, @Nonnull Node ancestor, double x, double y) { Point2D point2D = new Point2D(x, y); Node l_currentNode = node; while (l_currentNode != null) { if (l_currentNode == ancestor) { return point2D; } point2D = l_currentNode.localToParent(point2D); l_currentNode = l_currentNode.getParent(); } throw new IllegalStateException("Invalid ancestor <" + ancestor + "> for <" + node + ">"); }
Point2D thePoint = theSprite.localToParent( 0, 0 ); theSprite.setLayoutX( -(thePoint.getX()) ); theSprite.setLayoutY( -(thePoint.getY()) );
Point2D thePoint = theSprite.localToParent( 0, 0 ); theSprite.setLayoutX( -(thePoint.getX()) ); theSprite.setLayoutY( -(thePoint.getY()) );
private void selectIntersectingNodes(Parent root, boolean deselect) { List<Node> selectableNodes = root.getChildrenUnmodifiable(). filtered(n -> n instanceof SelectableNode); boolean rectBigEnough = rectangle.getWidth() > 1 || rectangle.getHeight() > 1; for (Node n : selectableNodes) { boolean selectN = rectangle.intersects( rectangle.parentToLocal( n.localToParent(n.getBoundsInLocal()))); SelectableNode sn = (SelectableNode) n; if ((deselect || potentiallySelected(sn)) || (selectN && rectBigEnough)) { WindowUtil.getDefaultClipboard().select( sn, (selectN && rectBigEnough)); } } }