From d836eb515edf6e7c2474d0dd1dbc190780829ec1 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Wed, 27 Jan 2021 08:57:46 +0200 Subject: [PATCH] further reduce min height to 730px on all platforms --- .../sparrowwallet/sparrow/AppServices.java | 2 +- .../sparrow/control/TransactionDiagram.java | 35 +++++++++++++------ .../transaction/TransactionController.java | 1 + .../sparrow/wallet/SendController.java | 4 +++ .../com/sparrowwallet/sparrow/wallet/send.css | 4 --- .../sparrowwallet/sparrow/wallet/send.fxml | 2 +- 6 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index c04ba785..158abe66 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -265,7 +265,7 @@ public class AppServices { stage.setTitle("Sparrow"); stage.setMinWidth(650); - stage.setMinHeight(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX ? 750 : 768); + stage.setMinHeight(730); stage.setScene(scene); stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/image/sparrow.png"))); diff --git a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java index a16a834a..eb785d35 100644 --- a/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java +++ b/src/main/java/com/sparrowwallet/sparrow/control/TransactionDiagram.java @@ -38,6 +38,9 @@ public class TransactionDiagram extends GridPane { private WalletTransaction walletTx; public void update(WalletTransaction walletTx) { + setMinHeight(getDiagramHeight()); + setMaxHeight(getDiagramHeight()); + if(walletTx == null) { getChildren().clear(); } else { @@ -131,7 +134,7 @@ public class TransactionDiagram extends GridPane { Line topYaxis = new Line(); topYaxis.setStartX(width * 0.5); - topYaxis.setStartY(DIAGRAM_HEIGHT * 0.5 - 20.0); + topYaxis.setStartY(getDiagramHeight() * 0.5 - 20.0); topYaxis.setEndX(width * 0.5); topYaxis.setEndY(0); topYaxis.getStyleClass().add("inputs-type"); @@ -145,16 +148,16 @@ public class TransactionDiagram extends GridPane { Line bottomYaxis = new Line(); bottomYaxis.setStartX(width * 0.5); - bottomYaxis.setStartY(DIAGRAM_HEIGHT); + bottomYaxis.setStartY(getDiagramHeight()); bottomYaxis.setEndX(width * 0.5); - bottomYaxis.setEndY(DIAGRAM_HEIGHT * 0.5 + 20.0); + bottomYaxis.setEndY(getDiagramHeight() * 0.5 + 20.0); bottomYaxis.getStyleClass().add("inputs-type"); Line bottomBracket = new Line(); bottomBracket.setStartX(width * 0.5); - bottomBracket.setStartY(DIAGRAM_HEIGHT); + bottomBracket.setStartY(getDiagramHeight()); bottomBracket.setEndX(width); - bottomBracket.setEndY(DIAGRAM_HEIGHT); + bottomBracket.setEndY(getDiagramHeight()); bottomBracket.getStyleClass().add("inputs-type"); group.getChildren().addAll(widthLine, topYaxis, topBracket, bottomYaxis, bottomBracket); @@ -240,7 +243,7 @@ public class TransactionDiagram extends GridPane { yaxisLine.setStartX(0); yaxisLine.setStartY(0); yaxisLine.setEndX(0); - yaxisLine.setEndY(DIAGRAM_HEIGHT); + yaxisLine.setEndY(getDiagramHeight()); yaxisLine.getStyleClass().add("boundary"); group.getChildren().add(yaxisLine); @@ -259,9 +262,9 @@ public class TransactionDiagram extends GridPane { double scaleFactor = (double)i / (numUtxos + 1); int nodeHeight = 17; double additional = (0.5 - scaleFactor) * ((double)nodeHeight); - curve.setStartY(scale(DIAGRAM_HEIGHT, scaleFactor, additional)); + curve.setStartY(scale(getDiagramHeight(), scaleFactor, additional)); curve.setEndX(width); - curve.setEndY(scale(DIAGRAM_HEIGHT, 0.5, 0)); + curve.setEndY(scale(getDiagramHeight(), 0.5, 0)); curve.setControlX1(scale(width, 0.2, 0)); curve.setControlY1(curve.getStartY()); @@ -320,12 +323,12 @@ public class TransactionDiagram extends GridPane { curve.getStyleClass().add("output-line"); curve.setStartX(0); - curve.setStartY(scale(DIAGRAM_HEIGHT, 0.5, 0)); + curve.setStartY(scale(getDiagramHeight(), 0.5, 0)); curve.setEndX(width); double scaleFactor = (double)i / (numOutputs + 1); int nodeHeight = 20; double additional = (0.5 - scaleFactor) * ((double)nodeHeight); - curve.setEndY(scale(DIAGRAM_HEIGHT, scaleFactor, additional)); + curve.setEndY(scale(getDiagramHeight(), scaleFactor, additional)); curve.setControlX1(scale(width, 0.2, 0)); curve.controlY1Property().bind(curve.startYProperty()); @@ -404,6 +407,18 @@ public class TransactionDiagram extends GridPane { return txPane; } + public double getDiagramHeight() { + if(isReducedHeight()) { + 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 0aad9cb9..0a2ee055 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/TransactionController.java @@ -64,6 +64,7 @@ public class TransactionController implements Initializable { public void initializeView() { initializeTxTree(); + transactionMasterDetail.setDividerPosition(0.82); transactionMasterDetail.setShowDetailNode(Config.get().isShowTransactionHex()); txhex.setTransaction(getTransaction()); highlightTxHex(); diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 2e0bbd18..b355a7ee 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -337,6 +337,10 @@ public class SendController extends WalletFormController implements Initializabl transactionDiagram.update(walletTransaction); createButton.setDisable(walletTransaction == null || isInsufficientFeeRate()); }); + + Platform.runLater(() -> { + transactionDiagram.update(null); + }); } private void initializeTabHeader(int count) { diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css index 22d0b083..de173ac1 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.css @@ -65,10 +65,6 @@ -fx-alignment: center-left; } -#transactionDiagram { - -fx-min-height: 215px; -} - #transactionDiagram .boundary { -fx-stroke: transparent; } diff --git a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml index ab125cb6..936f9438 100644 --- a/src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml +++ b/src/main/resources/com/sparrowwallet/sparrow/wallet/send.fxml @@ -127,7 +127,7 @@ - +