@Override protected boolean handleDisclosureNode(double x, double y) { final TreeItem<S> treeItem = getControl().getTreeTableRow().getTreeItem(); if (!treeItem.isLeaf()) { final Node disclosureNode = getControl().getTreeTableRow().getDisclosureNode(); if (disclosureNode != null) { if (disclosureNode.getBoundsInParent().contains(x + disclosureNode.getTranslateX(), y)) { if (treeItem != null) { treeItem.setExpanded(!treeItem.isExpanded()); } return true; } } } return false; } }
OverLayRipple() { super(); setOverLayBounds(this); this.getStyleClass().add("jfx-rippler-overlay"); // update initial position if(JFXRippler.this.getChildrenUnmodifiable().contains(control)) { double diffMinX = Math.abs(control.getBoundsInLocal().getMinX() - control.getLayoutBounds().getMinX()); double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); Bounds bounds = control.getBoundsInParent(); this.setX(bounds.getMinX() + diffMinX - snappedLeftInset()); this.setY(bounds.getMinY() + diffMinY - snappedTopInset()); } // set initial attributes setOpacity(0); setCache(true); setCacheHint(CacheHint.SPEED); setCacheShape(true); setManaged(false); } }
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0) .getBoundsInParent() .getMinY(); 2) + Math.pow(burger.getChildren() .get(0) .getBoundsInParent() .getWidth() / 2, 2)); double theta = (90 - angle) + Math.toDegrees(Math.atan((burger.getChildren() .getHeight()) / (burger.getChildren() .get(0) .getBoundsInParent() .getWidth() / 2))); double hOffset = Math.cos(Math.toRadians(theta)) * burgerDiagonal / 2;
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0) .getBoundsInParent() .getMinY(); 2) + Math.pow(burger.getChildren() .get(0) .getBoundsInParent() .getWidth() / 2, 2)); double theta = (90 - angle) + Math.toDegrees(Math.atan((burger.getChildren() .getHeight()) / (burger.getChildren() .get(0) .getBoundsInParent() .getWidth() / 2))); double hOffset = Math.cos(Math.toRadians(theta)) * burgerDiagonal / 2;
Bounds bounds = control.getBoundsInParent(); double width = control.getLayoutBounds().getWidth(); double height = control.getLayoutBounds().getHeight();
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0) .getBoundsInParent() .getMinY();
private static Timeline createTimeline(JFXHamburger burger) { double burgerWidth = burger.getChildren().get(0).getLayoutBounds().getWidth(); double burgerHeight = burger.getChildren().get(2).getBoundsInParent().getMaxY() - burger.getChildren() .get(0) .getBoundsInParent() .getMinY();
public void centerNodeInScrollPane(ScrollPane scrollPane, Node node) { double h = scrollPane.getContent().getBoundsInLocal().getHeight(); double y = (node.getBoundsInParent().getMaxY() + node.getBoundsInParent().getMinY()) / 2.0; double v = scrollPane.getViewportBounds().getHeight(); scrollPane.setVvalue(scrollPane.getVmax() * ((y - 0.5 * v) / (h - v))); }
calcCenter(node.getBoundsInParent()); node.boundsInParentProperty().addListener(new ChangeListener<Bounds>() { @Override public void changed(
@Override protected double computeMinWidth(double h) { double minX = Double.MAX_VALUE; double maxX = Double.MIN_VALUE; for (Node n : getManagedChildren()) { minX = Math.min(minX, n.getBoundsInParent().getMinX()); maxX = Math.max(maxX, n.getBoundsInParent().getMaxX()); } return maxX; }
@Override protected double computeMinHeight(double w) { double minY = Double.MAX_VALUE; double maxY = Double.MIN_VALUE; for (Node n : getManagedChildren()) { minY = Math.min(minY, n.getBoundsInParent().getMinY()); maxY = Math.max(maxY, n.getBoundsInParent().getMaxY()); } return maxY; }
public <T extends Node & Caret> Bounds getCaretBounds(T caret) { layout(); // ensure layout, is a no-op if not dirty checkWithinParagraph(caret); return caret.getBoundsInParent(); }
/** * Resizes the specified rectangle to the specified node's {@link Node#boundsInParentProperty() boundsInParent}. * * @param rectangle * the {@link Rectangle} which will be resized * @param node * the {@link Node} to whose bounds the {@code rectangle} will be resized */ private static void resizeRectangleToNodeBounds(Rectangle rectangle, Node node) { if (node == null) { resizeRectangleToZero(rectangle); } else { resizeRectangleToBounds(rectangle, node.getBoundsInParent()); } }
public Collection<? extends HoverTarget> findHoverTargets(Point2D localLocation) { return this.usedNodes.entrySet().stream() .filter(e->e.getValue().getBoundsInParent().contains(localLocation)) .map(e->{ TextAnnotation annotation = e.getKey(); Bounds bounds = e.getValue().getBoundsInLocal(); Point2D anchor = new Point2D(bounds.getMinX(), bounds.getMaxY()); HoverTarget annotationTarget = new HoverTarget(annotation, toGlobal(annotation.getRange()), e.getValue().localToScreen(anchor), e.getValue().localToScreen(bounds)); return annotationTarget; }) .collect(Collectors.toList()); }
private static void ensureVisible(ScrollPane pane, Node node) { Bounds viewport = pane.getViewportBounds(); double contentHeight = pane.getContent().getBoundsInLocal().getHeight(); double nodeMinY = node.getBoundsInParent().getMinY(); double nodeMaxY = node.getBoundsInParent().getMaxY(); double viewportMinY = (contentHeight - viewport.getHeight()) * pane.getVvalue(); double viewportMaxY = viewportMinY + viewport.getHeight(); if (nodeMinY < viewportMinY) { pane.setVvalue(nodeMinY / (contentHeight - viewport.getHeight())); } else if (nodeMaxY > viewportMaxY) { pane.setVvalue((nodeMaxY - viewport.getHeight()) / (contentHeight - viewport.getHeight())); } }
/** * To bounds X. * * @param aTranslateX the translate X * @param aSprite the sprite * @return the double */ private double toBoundsX( double aTranslateX, Node aSprite ) { return toBounds( aTranslateX, aSprite.getBoundsInParent().getWidth(), _scene.getWidth() ); }
/** * To bounds Y. * * @param aTranslateY the translate Y * @param aSprite the sprite * @return the double */ private double toBoundsY( double aTranslateY, Node aSprite ) { return toBounds( aTranslateY, aSprite.getBoundsInParent().getHeight(), _scene.getHeight() ); }
/** * To snap X. * * @param aTranslateX the translate X * @param aSprite the sprite * @return the double */ private double toSnapX( double aTranslateX, Node aSprite ) { return toSnap( aTranslateX, aSprite.getBoundsInParent().getWidth(), getFieldWidth(), _scene.getWidth() ); }
/** * To snap Y. * * @param aTranslateY the translate Y * @param aSprite the sprite * @return the double */ private double toSnapY( double aTranslateY, Node aSprite ) { return toSnap( aTranslateY, aSprite.getBoundsInParent().getHeight(), getFieldHeight(), _scene.getHeight() ); }
/** * Resizes the current {@link SnapshotView#selectionProperty() selection} from the control's to the node's * bounds */ private void resizeSelectionFromControlToNode() { if (getNode() == null) { setSelection(null); } else { // transform the selection from the control's to the node's bounds Rectangle2D controlBounds = new Rectangle2D(0, 0, getWidth(), getHeight()); Rectangle2D nodeBounds = Rectangles2D.fromBounds(getNode().getBoundsInParent()); resizeSelectionToNewBounds(controlBounds, nodeBounds); } }