@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateY(-(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY())); }
@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateY(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()); }
private void showAutocompletePopup(int insertionIndex, String input) { CompletionResultSource suggestionMaker = mySuggestionProvider.get(); List<MenuItem> suggestions = suggestionMaker.getSortedMatches(input, 5) .map(result -> { Label entryLabel = new Label(); entryLabel.setGraphic(result.getTextFlow()); entryLabel.setPrefHeight(5); CustomMenuItem item = new CustomMenuItem(entryLabel, true); item.setUserData(result); item.setOnAction(e -> applySuggestion(insertionIndex, input, result.getNodeName())); return item; }) .collect(Collectors.toList()); autoCompletePopup.getItems().setAll(suggestions); myCodeArea.getCharacterBoundsOnScreen(insertionIndex, insertionIndex + input.length()) .ifPresent(bounds -> autoCompletePopup.show(myCodeArea, bounds.getMinX(), bounds.getMaxY())); Skin<?> skin = autoCompletePopup.getSkin(); if (skin != null) { Node fstItem = skin.getNode().lookup(".menu-item"); if (fstItem != null) { fstItem.requestFocus(); } } }
double diffMinY = Math.abs(control.getBoundsInLocal().getMinY() - control.getLayoutBounds().getMinY()); double diffMaxX = Math.abs(control.getBoundsInLocal().getMaxX() - control.getLayoutBounds().getMaxX()); double diffMaxY = Math.abs(control.getBoundsInLocal().getMaxY() - control.getLayoutBounds().getMaxY()); Node mask; switch (getMaskType()) { double radius = Math.min((width / 2) - 2 * borderWidth, (height / 2) - 2 * borderWidth); mask = new Circle((bounds.getMinX() + diffMinX + bounds.getMaxX() - diffMaxX) / 2 - snappedLeftInset(), (bounds.getMinY() + diffMinY + bounds.getMaxY() - diffMaxY) / 2 - snappedTopInset(), radius, Color.BLUE);
public VerticalTransition(boolean topDirection, Node contentContainer, Node overlay) { super(contentContainer, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(contentContainer.translateYProperty(), (contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()) * (topDirection? -1 : 1), Interpolator.LINEAR), new KeyValue(overlay.opacityProperty(), 0, Interpolator.EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(overlay.opacityProperty(), 1, Interpolator.EASE_BOTH), new KeyValue(contentContainer.translateYProperty(), 0, Interpolator.EASE_OUT) ))); // reduce the number to increase the shifting , increase number to reduce shifting setCycleDuration(Duration.seconds(0.4)); setDelay(Duration.seconds(0)); } }
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()
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()
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()
@Override protected void layoutChildren(double x, double y, double w, double h) { super.layoutChildren(x, y, w, h); if (!isValid) { initializeVariables(); initAnimation(getSkinnable().getOrientation()); isValid = true; } double prefWidth = animatedThumb.prefWidth(-1); animatedThumb.resize(prefWidth, animatedThumb.prefHeight(prefWidth)); boolean horizontal = getSkinnable().getOrientation() == Orientation.HORIZONTAL; double width, height, layoutX, layoutY; if (horizontal) { width = thumb.getLayoutX() - snappedLeftInset(); height = track.getHeight(); layoutX = track.getLayoutX(); layoutY = track.getLayoutY(); animatedThumb.setLayoutX(thumb.getLayoutX() + thumb.getWidth() / 2 - animatedThumb.getWidth() / 2); } else { height = track.getLayoutBounds().getMaxY() + track.getLayoutY() - thumb.getLayoutY() - snappedBottomInset(); width = track.getWidth(); layoutX = track.getLayoutX(); layoutY = thumb.getLayoutY(); animatedThumb.setLayoutY(thumb.getLayoutY() + thumb.getHeight() / 2 - animatedThumb.getHeight() / 2); } coloredTrack.resizeRelocate(layoutX, layoutY, width, height); mouseHandlerPane.resizeRelocate(x, y, w, h); }
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()
/** * @return maxY of internal bounds (y + height) */ public double getMaxY() { return bounds.getMaxY(); }
private static Text helpIcon(HelpPopup popup) { Text icon = MaterialDesignIconFactory.get().createIcon(MaterialDesignIcon.HELP_CIRCLE, "1.1em"); icon.setOnMouseEntered(e -> { Point2D p = icon.localToScreen(icon.getLayoutBounds().getMaxX(), icon.getLayoutBounds().getMaxY()); popup.show(icon, p.getX(), p.getY()); }); icon.setOnMouseExited(e -> popup.hide()); return icon; } }
Bounds locBounds = cuboid.getBoundsInLocal(); List<Point3D> normals=Arrays.asList(new Point3D(-1,0,0),new Point3D(1,0,0), new Point3D(0,-1,0), new Point3D(0,1,0), new Point3D(0,0,-1), new Point3D(0,0,1)); List<Point3D> positions=Arrays.asList(new Point3D(locBounds.getMinX(),0,0), new Point3D(locBounds.getMaxX(),0,0), new Point3D(0,locBounds.getMinY(),0), new Point3D(0,locBounds.getMaxY(),0), new Point3D(0,0,locBounds.getMinZ()), new Point3D(0,0,locBounds.getMaxZ()));
@Override public void initAnimation(Node contentContainer, Node overlay) { overlay.setOpacity(0); contentContainer.setTranslateY(contentContainer.getLayoutY() + contentContainer.getLayoutBounds().getMaxY()); }
/** * @return center point of this hit box, local to 0,0 (top,left) of the entity */ public Point2D centerLocal() { return new Point2D((bounds.getMinX() + bounds.getMaxX()) / 2, (bounds.getMinY() + bounds.getMaxY()) / 2); }
Button bt; Bounds localBounds = bt.localToScene(bt.getBoundsInLocal()); double popupX = bt.getScene().getWindow().getX() + localBounds.getMaxX(); double popupY = bt.getScene().getWindow().getY() + localBounds.getMaxY();
/** * Indicates whether the specified selection is inside the specified bounds. * * @param selection * the selection as a {@link Rectangle2D} * @param bounds * the {@link Bounds} to check the selection against * @return {@code true} if the selection is fully contained in the bounds; otherwise {@code false} */ private static boolean inBounds(Rectangle2D selection, Bounds bounds) { return bounds.getMinX() <= selection.getMinX() && bounds.getMinY() <= selection.getMinY() && selection.getMaxX() <= bounds.getMaxX() && selection.getMaxY() <= bounds.getMaxY(); }
public void setPosition(Point3DReadOnly position) { positionDecoupled.set(position); Bounds boundsInLocal = text3dMesh.getBoundsInLocal(); text3dMesh.setTranslateX(((boundsInLocal.getMinX() - boundsInLocal.getMaxX()) / 2.0) - boundsInLocal.getMinX() + positionDecoupled.getX()); text3dMesh.setTranslateY(((boundsInLocal.getMaxY() - boundsInLocal.getMinY()) / 2.0) - boundsInLocal.getMaxY() + positionDecoupled.getY()); text3dMesh.setTranslateZ(((boundsInLocal.getMinZ() - boundsInLocal.getMaxZ()) / 2.0) - boundsInLocal.getMinZ() + positionDecoupled.getZ()); }
private static Point2D project(Point2D p, Bounds bounds) { double x = clamp(p.getX(), bounds.getMinX(), bounds.getMaxX()); double y = clamp(p.getY(), bounds.getMinY(), bounds.getMaxY()); return new Point2D(x, y); }
public void setPosition(TransformablePoint3d position) { positionDecoupled.set(position); Bounds boundsInLocal = text3dMesh.getBoundsInLocal(); text3dMesh.setTranslateX(((boundsInLocal.getMinX() - boundsInLocal.getMaxX()) / 2.0) - boundsInLocal.getMinX() + positionDecoupled.getX()); text3dMesh.setTranslateY(((boundsInLocal.getMaxY() - boundsInLocal.getMinY()) / 2.0) - boundsInLocal.getMaxY() + positionDecoupled.getY()); text3dMesh.setTranslateZ(((boundsInLocal.getMinZ() - boundsInLocal.getMaxZ()) / 2.0) - boundsInLocal.getMinZ() + positionDecoupled.getZ()); }