set tx hex divider lower when window height is reduced

This commit is contained in:
Craig Raw 2021-01-27 09:16:58 +02:00
parent d836eb515e
commit 650c3657a5
3 changed files with 8 additions and 5 deletions

View file

@ -21,6 +21,7 @@ import javafx.beans.value.ObservableValue;
import javafx.concurrent.ScheduledService; import javafx.concurrent.ScheduledService;
import javafx.concurrent.Worker; import javafx.concurrent.Worker;
import javafx.fxml.FXMLLoader; import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.scene.control.Alert; 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() { public MainApp getApplication() {
return application; return application;
} }

View file

@ -408,17 +408,13 @@ public class TransactionDiagram extends GridPane {
} }
public double getDiagramHeight() { public double getDiagramHeight() {
if(isReducedHeight()) { if(AppServices.isReducedWindowHeight(this)) {
return DIAGRAM_HEIGHT - 40; return DIAGRAM_HEIGHT - 40;
} }
return DIAGRAM_HEIGHT; return DIAGRAM_HEIGHT;
} }
private boolean isReducedHeight() {
return (this.getScene() != null && this.getScene().getWindow().getHeight() < 768);
}
private Node createSpacer() { private Node createSpacer() {
final Region spacer = new Region(); final Region spacer = new Region();
VBox.setVgrow(spacer, Priority.ALWAYS); VBox.setVgrow(spacer, Priority.ALWAYS);

View file

@ -76,6 +76,8 @@ public class TransactionController implements Initializable {
} else if(TransactionView.OUTPUT.equals(initialView) && initialIndex >= PageForm.PAGE_SIZE) { } else if(TransactionView.OUTPUT.equals(initialView) && initialIndex >= PageForm.PAGE_SIZE) {
fetchOutputBlockTransactions(initialIndex, initialIndex + 1); fetchOutputBlockTransactions(initialIndex, initialIndex + 1);
} }
Platform.runLater(() -> transactionMasterDetail.setDividerPosition(AppServices.isReducedWindowHeight(transactionMasterDetail) ? 0.9 : 0.82));
} }
private void initializeTxTree() { private void initializeTxTree() {