From 650c3657a5a73560e2f42925a3fbec14c4d34cc5 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 27 Jan 2021 09:16:58 +0200 Subject: [PATCH] set tx hex divider lower when window height is reduced --- src/main/java/com/sparrowwallet/sparrow/AppServices.java | 5 +++++ .../sparrowwallet/sparrow/control/TransactionDiagram.java | 6 +----- .../sparrow/transaction/TransactionController.java | 2 ++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index 158abe66..05ae62f3 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -21,6 +21,7 @@ import javafx.beans.value.ObservableValue; import javafx.concurrent.ScheduledService; import javafx.concurrent.Worker; import javafx.fxml.FXMLLoader; +import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Alert; @@ -278,6 +279,10 @@ public class AppServices { } } + public static boolean isReducedWindowHeight(Node node) { + return (node.getScene() != null && node.getScene().getWindow().getHeight() < 768); + } + public MainApp getApplication() { return application; } diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index eb785d35..06b426a7 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -408,17 +408,13 @@ public class TransactionDiagram extends GridPane { } public double getDiagramHeight() { - if(isReducedHeight()) { + if(AppServices.isReducedWindowHeight(this)) { return DIAGRAM_HEIGHT - 40; } return DIAGRAM_HEIGHT; } - private boolean isReducedHeight() { - return (this.getScene() != null && this.getScene().getWindow().getHeight() < 768); - } - private Node createSpacer() { final Region spacer = new Region(); VBox.setVgrow(spacer, Priority.ALWAYS); diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java index 0a2ee055..41b1a6fc 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java @@ -76,6 +76,8 @@ public class TransactionController implements Initializable { } else if(TransactionView.OUTPUT.equals(initialView) && initialIndex >= PageForm.PAGE_SIZE) { fetchOutputBlockTransactions(initialIndex, initialIndex + 1); } + + Platform.runLater(() -> transactionMasterDetail.setDividerPosition(AppServices.isReducedWindowHeight(transactionMasterDetail) ? 0.9 : 0.82)); } private void initializeTxTree() {