if (!maximized) { originalBox = new BoundingBox(primaryStage.getX(), primaryStage.getY(), primaryStage.getWidth(), primaryStage.getHeight()); primaryStage.getHeight()).get(0); Rectangle2D bounds = screen.getVisualBounds(); maximizedBox = new BoundingBox(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()); primaryStage.setX(maximizedBox.getMinX()); primaryStage.setY(maximizedBox.getMinY()); primaryStage.setWidth(maximizedBox.getWidth()); primaryStage.setHeight(maximizedBox.getHeight()); btnMax.setGraphic(resizeMin); btnMax.setTooltip(new Tooltip("Restore Down")); } else { primaryStage.setX(originalBox.getMinX()); primaryStage.setY(originalBox.getMinY()); primaryStage.setWidth(originalBox.getWidth()); primaryStage.setHeight(originalBox.getHeight()); originalBox = null; btnMax.setGraphic(resizeMax);
return new BoundingBox(x, y, minCol - y, minRow - x);
boolean isInsideStateIcon(Point2D point) { BoundingBox bounds = new BoundingBox(expandedStateLabel.getLayoutX(), expandedStateLabel.getLayoutY(), expandedStateLabel.getWidth(), expandedStateLabel.getHeight()); return bounds.contains(point); }
protected boolean validHeight(BoundingBox box, Region region, double cellH, double gutterX, double gutterY) { boolean valid = false; if (region.getMinHeight() != -1 && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY < region.getMinHeight()) { return false; } if (region.getPrefHeight() == USE_COMPUTED_SIZE && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY >= region .prefHeight(region.prefWidth(-1))) { valid = true; } if (region.getPrefHeight() != USE_COMPUTED_SIZE && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY >= region .getPrefHeight()) { valid = true; } return valid; }
protected boolean validWidth(BoundingBox box, Region region, double cellW, double gutterX, double gutterY) { boolean valid = false; if (region.getMinWidth() != -1 && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX < region.getMinWidth()) { return false; } if (region.getPrefWidth() == USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region .prefWidth(-1)) { valid = true; } if (region.getPrefWidth() != USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region .getPrefWidth()) { valid = true; } return valid; }
double startX = maxX - width; rectBounds.add(new BoundingBox(textBounds.getMinX() + startX, textBounds.getMinY() + startY, width, temp.getLayoutBounds().getHeight()));
if (w != null && new BoundingBox(w.getX(), w.getY(), w.getWidth(), w.getHeight()).contains(screenX, screenY)) { return findNode(w.getScene().getRoot(), screenX, screenY); if (!FIND_NODE_EXCLUDE.equals(window.getUserData()) && new BoundingBox(window.getX(), window.getY(), window.getWidth(), window.getHeight()).contains(screenX, screenY)) { return findNode(window.getScene().getRoot(), screenX, screenY);
protected boolean validHeight(BoundingBox box, Region region, double cellH, double gutterX, double gutterY) { boolean valid = false; if (region.getMinHeight() != -1 && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY < region.getMinHeight()) { return false; } if (region.getPrefHeight() == USE_COMPUTED_SIZE && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY >= region .prefHeight(region.prefWidth(-1))) { valid = true; } if (region.getPrefHeight() != USE_COMPUTED_SIZE && box.getHeight() * cellH + (box.getHeight() - 1) * 2 * gutterY >= region .getPrefHeight()) { valid = true; } return valid; }
protected boolean validWidth(BoundingBox box, Region region, double cellW, double gutterX, double gutterY) { boolean valid = false; if (region.getMinWidth() != -1 && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX < region.getMinWidth()) { return false; } if (region.getPrefWidth() == USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region .prefWidth(-1)) { valid = true; } if (region.getPrefWidth() != USE_COMPUTED_SIZE && box.getWidth() * cellW + (box.getWidth() - 1) * 2 * gutterX >= region .getPrefWidth()) { valid = true; } return valid; }
final Optional<Bounds> getSelectionBoundsOnScreen(Selection<PS, SEG, S> selection) { if (selection.getLength() == 0) { return Optional.empty(); } List<Bounds> bounds = new ArrayList<>(selection.getParagraphSpan()); for (int i = selection.getStartParagraphIndex(); i <= selection.getEndParagraphIndex(); i++) { virtualFlow.getCellIfVisible(i) .ifPresent(c -> c.getNode() .getSelectionBoundsOnScreen(selection) .ifPresent(bounds::add) ); } if(bounds.size() == 0) { return Optional.empty(); } double minX = bounds.stream().mapToDouble(Bounds::getMinX).min().getAsDouble(); double maxX = bounds.stream().mapToDouble(Bounds::getMaxX).max().getAsDouble(); double minY = bounds.stream().mapToDouble(Bounds::getMinY).min().getAsDouble(); double maxY = bounds.stream().mapToDouble(Bounds::getMaxY).max().getAsDouble(); return Optional.of(new BoundingBox(minX, minY, maxX-minX, maxY-minY)); }
/** * Find a node in all windows * * @param w * the preferred window * @param screenX * the screen x * @param screenY * the screen y * @return the node or <code>null</code> */ @SuppressWarnings("deprecation") public static Node findNode(Window w, double screenX, double screenY) { // First check the owner if (new BoundingBox(w.getX(), w.getY(), w.getWidth(), w.getHeight()).contains(screenX, screenY)) { return findNode(w.getScene().getRoot(), screenX, screenY); } // FIXME If multiple match take the closest Iterator<Window> impl_getWindows = Window.impl_getWindows(); while (impl_getWindows.hasNext()) { Window window = impl_getWindows.next(); if (!FIND_NODE_EXCLUDE.equals(window.getUserData()) && new BoundingBox(window.getX(), window.getY(), window.getWidth(), window.getHeight()).contains(screenX, screenY)) { return findNode(window.getScene().getRoot(), screenX, screenY); } } return null; }
return new BoundingBox(x, y, minCol - y, minRow - x);
double blockHeight; if (boundingBox != null) { blockX = boundingBox.getMinY() * getCellWidth() + boundingBox.getMinY() * getHSpacing() + snappedLeftInset(); blockY = boundingBox.getMinX() * getCellHeight() + boundingBox.getMinX() * getVSpacing() + snappedTopInset(); blockWidth = boundingBox.getWidth() * getCellWidth() + (boundingBox.getWidth() - 1) * getHSpacing(); blockHeight = boundingBox.getHeight() * getCellHeight() + (boundingBox.getHeight() - 1) * getVSpacing(); } else { blockX = child.getLayoutX(); BoundingBox oldBoundingBox = oldBoxes.get(child); if (oldBoundingBox == null || (!oldBoundingBox.equals(boundingBox) && dirtyBoxes)) {
public static Bounds intersection(Bounds b1, Bounds b2) { Rectangle r1 = toRectangle(b1); Rectangle r2 = toRectangle(b2); Rectangle i = r1.intersection(r2); return new BoundingBox(i.getMinX(), i.getMinY(), i.getWidth(), i.getHeight()); }
public void restoreFullScreenSavedBounds(Stage stage) { if (savedFullScreenBounds != null) { stage.setX(savedFullScreenBounds.getMinX()); stage.setY(savedFullScreenBounds.getMinY()); stage.setWidth(savedFullScreenBounds.getWidth()); stage.setHeight(savedFullScreenBounds.getHeight()); savedFullScreenBounds = null; } }
private static Bounds extendLeft(Bounds b, double w) { if(w == 0) { return b; } else { return new BoundingBox( b.getMinX() - w, b.getMinY(), b.getWidth() + w, b.getHeight()); } }
/** * Computes new bounds based on translated X and Y * of an entity. * * @param x entity x * @param y entity y * @return computed bounds */ public Bounds translate(double x, double y) { return new BoundingBox(x + bounds.getMinX(), y + bounds.getMinY(), bounds.getWidth(), bounds.getHeight()); }