Example usage for javafx.geometry Bounds getMinY

List of usage examples for javafx.geometry Bounds getMinY

Introduction

In this page you can find the example usage for javafx.geometry Bounds getMinY.

Prototype

public final double getMinY() 

Source Link

Document

The y coordinate of the upper-left corner of this Bounds .

Usage

From source file:Main.java

private void playParentBoundsPathTransition() {
    Bounds b = mainRect.getBoundsInParent();

    Path path = new Path();
    path.getElements().add(new MoveTo(b.getMinX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMinY()));
    path.getElements().add(new LineTo(b.getMaxX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMaxY()));
    path.getElements().add(new LineTo(b.getMinX(), b.getMinY()));

    PARENT_BOUNDS_PATH_TRANSITION.setPath(path);
    PARENT_BOUNDS_PATH_TRANSITION.play();
}

From source file:Main.java

private void showBounds() {
    if (layoutCbx.isSelected()) {
        Bounds b = mainRect.getLayoutBounds();
        layoutBoundsRect.setX(b.getMinX());
        layoutBoundsRect.setY(b.getMinY());
        layoutBoundsRect.setWidth(b.getWidth());
        layoutBoundsRect.setHeight(b.getHeight());

        layoutBoundsRect.setVisible(true);
    } else {/*from w  ww  .  j  a v a 2s  .  c  om*/
        layoutBoundsRect.setVisible(false);
    }

    if (localCbx.isSelected()) {
        Bounds b1 = mainRect.getBoundsInLocal();

        Bounds b = b1; // mainRect.localToParent(b1);
        localBoundsRect.setX(b.getMinX());
        localBoundsRect.setY(b.getMinY());
        localBoundsRect.setWidth(b.getWidth());
        localBoundsRect.setHeight(b.getHeight());
        localBoundsRect.setVisible(true);
    } else {
        localBoundsRect.setVisible(false);
    }

    if (parentCbx.isSelected()) {
        Bounds b = mainRect.getBoundsInParent();
        parentBoundsRect.setX(b.getMinX());
        parentBoundsRect.setY(b.getMinY());
        parentBoundsRect.setWidth(b.getWidth());
        parentBoundsRect.setHeight(b.getHeight());
        parentBoundsRect.setVisible(true);
    } else {
        parentBoundsRect.setVisible(false);
    }
}

From source file:org.geopoke.WorldMap.java

/**
     * Get a snapshot of the current map as an image.
     * <p/>/*ww  w .  j ava 2s  .c o  m*/
     * @return the current snapshot of the map.
     */
    public BufferedImage getSnapshot() {
        BufferedImage image = SwingFXUtils.fromFXImage(getScene().snapshot(null), null);
        Bounds bounds = localToScene(getLayoutBounds());
        return image.getSubimage((int) bounds.getMinX(), (int) bounds.getMinY(), (int) getWidth(),
                (int) getHeight());
    }

From source file:org.sleuthkit.autopsy.imageanalyzer.gui.GroupPane.java

@ThreadConfined(type = ThreadType.UI)
private void scrollToFileID(final Long newFileID) {
    if (newFileID == null) {
        //scrolling to no file doesn't make sense, so abort.
        return;/*from  www  .  j  a va2  s  .c o  m*/
    }

    int selectedIndex = grouping.get().fileIds().indexOf(newFileID);

    if (selectedIndex == -1) {
        //somehow we got passed a file id that isn't in the curent group.
        //this should never happen, but if it does everything is going to fail, so abort.
        return;
    }

    Optional<ScrollBar> scrollBarOptional = getScrollBar();
    scrollBarOptional.ifPresent((ScrollBar scrollBar) -> {
        DrawableCell cell = cellMap.get(newFileID);

        //while there is no tile/cell for the given id, scroll based on index in group
        while (cell == null) {
            Integer minIndex = cellMap.keySet().stream().map(grouping.get().fileIds()::indexOf)
                    .min(Integer::compare).get();
            Integer maxIndex = cellMap.keySet().stream().map(grouping.get().fileIds()::indexOf)
                    .max(Integer::compare).get();

            if (selectedIndex < minIndex) {
                scrollBar.decrement();
            } else if (selectedIndex > maxIndex) {
                scrollBar.increment();
            } else {
                //sometimes the cellMap isn't up to date, so move the position arbitrarily to update the cellMap
                //TODO: this is clunky and slow, find a better way to do this
                scrollBar.adjustValue(.5);
            }
            cell = cellMap.get(newFileID);

        }

        final Bounds gridViewBounds = gridView.localToScene(gridView.getBoundsInLocal());

        Bounds tileBounds = cell.localToScene(cell.getBoundsInLocal());

        //while the cell is not within the visisble bounds of the gridview, scroll based on screen coordinates
        int i = 0;

        while (gridViewBounds.contains(tileBounds) == false && (i++ < 100)) {

            if (tileBounds.getMinY() < gridViewBounds.getMinY()) {
                scrollBar.decrement();
            } else if (tileBounds.getMaxY() > gridViewBounds.getMaxY()) {
                scrollBar.increment();
            }
            tileBounds = cell.localToScene(cell.getBoundsInLocal());
        }
    });
}

From source file:org.sleuthkit.autopsy.imagegallery.gui.drawableviews.GroupPane.java

@ThreadConfined(type = ThreadType.JFX)
private void scrollToFileID(final Long newFileID) {
    if (newFileID == null) {
        return; //scrolling to no file doesn't make sense, so abort.
    }/*from  w  w  w.j av a 2  s  .co  m*/

    final ObservableList<Long> fileIds = gridView.getItems();

    int selectedIndex = fileIds.indexOf(newFileID);
    if (selectedIndex == -1) {
        //somehow we got passed a file id that isn't in the curent group.
        //this should never happen, but if it does everything is going to fail, so abort.
        return;
    }

    getScrollBar().ifPresent(scrollBar -> {
        DrawableCell cell = cellMap.get(newFileID);

        //while there is no tile/cell for the given id, scroll based on index in group
        while (isNull(cell)) {
            //TODO:  can we maintain a cached mapping from fileID-> index to speed up performance
            //get the min and max index of files that are in the cellMap
            Integer minIndex = cellMap.keySet().stream().mapToInt(fileID -> fileIds.indexOf(fileID)).min()
                    .getAsInt();
            Integer maxIndex = cellMap.keySet().stream().mapToInt(fileID -> fileIds.indexOf(fileID)).max()
                    .getAsInt();

            //[minIndex, maxIndex] is the range of indexes in the fileIDs list that are currently displayed
            if (selectedIndex < minIndex) {
                scrollBar.decrement();
            } else if (selectedIndex > maxIndex) {
                scrollBar.increment();
            } else {
                //sometimes the cellMap isn't up to date, so move the position arbitrarily to update the cellMap
                //TODO: this is clunky and slow, find a better way to do this
                scrollBar.adjustValue(.5);
            }
            cell = cellMap.get(newFileID);
        }

        final Bounds gridViewBounds = gridView.localToScene(gridView.getBoundsInLocal());
        Bounds tileBounds = cell.localToScene(cell.getBoundsInLocal());

        //while the cell is not within the visisble bounds of the gridview, scroll based on screen coordinates
        int i = 0;
        while (gridViewBounds.contains(tileBounds) == false && (i++ < 100)) {

            if (tileBounds.getMinY() < gridViewBounds.getMinY()) {
                scrollBar.decrement();
            } else if (tileBounds.getMaxY() > gridViewBounds.getMaxY()) {
                scrollBar.increment();
            }
            tileBounds = cell.localToScene(cell.getBoundsInLocal());
        }
    });
}

From source file:view.EditorView.java

@FXML
void insertRoomOnMouseDragged(MouseEvent event) {
    Bounds scrollPaneBounds = scrollPaneContainer.localToScene(scrollPane.getBoundsInLocal());
    if (event.getSceneX() >= scrollPaneBounds.getMinX() && event.getSceneX() <= scrollPaneBounds.getMaxX()
            && event.getSceneY() >= scrollPaneBounds.getMinY()
            && event.getSceneY() <= scrollPaneBounds.getMaxY()) {
        // we're in the scroll pane
        if (!isMouseOverDrawing) {
            scrollPaneOnMouseEntered(event);
        }//  ww w.ja  v  a2 s  . c o m
    } else {
        if (isMouseOverDrawing) {
            scrollPaneOnMouseExited(event);
        }
    }
    scrollPaneOnMouseMoved(event);
}