further reduce min height to 730px on all platforms

This commit is contained in:
Craig Raw 2021-01-27 08:57:46 +02:00
parent 717bc9fec2
commit d836eb515e
6 changed files with 32 additions and 16 deletions

View file

@ -265,7 +265,7 @@ public class AppServices {
stage.setTitle("Sparrow"); stage.setTitle("Sparrow");
stage.setMinWidth(650); stage.setMinWidth(650);
stage.setMinHeight(org.controlsfx.tools.Platform.getCurrent() == org.controlsfx.tools.Platform.OSX ? 750 : 768); stage.setMinHeight(730);
stage.setScene(scene); stage.setScene(scene);
stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/image/sparrow.png"))); stage.getIcons().add(new Image(MainApp.class.getResourceAsStream("/image/sparrow.png")));

View file

@ -38,6 +38,9 @@ public class TransactionDiagram extends GridPane {
private WalletTransaction walletTx; private WalletTransaction walletTx;
public void update(WalletTransaction walletTx) { public void update(WalletTransaction walletTx) {
setMinHeight(getDiagramHeight());
setMaxHeight(getDiagramHeight());
if(walletTx == null) { if(walletTx == null) {
getChildren().clear(); getChildren().clear();
} else { } else {
@ -131,7 +134,7 @@ public class TransactionDiagram extends GridPane {
Line topYaxis = new Line(); Line topYaxis = new Line();
topYaxis.setStartX(width * 0.5); 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.setEndX(width * 0.5);
topYaxis.setEndY(0); topYaxis.setEndY(0);
topYaxis.getStyleClass().add("inputs-type"); topYaxis.getStyleClass().add("inputs-type");
@ -145,16 +148,16 @@ public class TransactionDiagram extends GridPane {
Line bottomYaxis = new Line(); Line bottomYaxis = new Line();
bottomYaxis.setStartX(width * 0.5); bottomYaxis.setStartX(width * 0.5);
bottomYaxis.setStartY(DIAGRAM_HEIGHT); bottomYaxis.setStartY(getDiagramHeight());
bottomYaxis.setEndX(width * 0.5); 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"); bottomYaxis.getStyleClass().add("inputs-type");
Line bottomBracket = new Line(); Line bottomBracket = new Line();
bottomBracket.setStartX(width * 0.5); bottomBracket.setStartX(width * 0.5);
bottomBracket.setStartY(DIAGRAM_HEIGHT); bottomBracket.setStartY(getDiagramHeight());
bottomBracket.setEndX(width); bottomBracket.setEndX(width);
bottomBracket.setEndY(DIAGRAM_HEIGHT); bottomBracket.setEndY(getDiagramHeight());
bottomBracket.getStyleClass().add("inputs-type"); bottomBracket.getStyleClass().add("inputs-type");
group.getChildren().addAll(widthLine, topYaxis, topBracket, bottomYaxis, bottomBracket); group.getChildren().addAll(widthLine, topYaxis, topBracket, bottomYaxis, bottomBracket);
@ -240,7 +243,7 @@ public class TransactionDiagram extends GridPane {
yaxisLine.setStartX(0); yaxisLine.setStartX(0);
yaxisLine.setStartY(0); yaxisLine.setStartY(0);
yaxisLine.setEndX(0); yaxisLine.setEndX(0);
yaxisLine.setEndY(DIAGRAM_HEIGHT); yaxisLine.setEndY(getDiagramHeight());
yaxisLine.getStyleClass().add("boundary"); yaxisLine.getStyleClass().add("boundary");
group.getChildren().add(yaxisLine); group.getChildren().add(yaxisLine);
@ -259,9 +262,9 @@ public class TransactionDiagram extends GridPane {
double scaleFactor = (double)i / (numUtxos + 1); double scaleFactor = (double)i / (numUtxos + 1);
int nodeHeight = 17; int nodeHeight = 17;
double additional = (0.5 - scaleFactor) * ((double)nodeHeight); double additional = (0.5 - scaleFactor) * ((double)nodeHeight);
curve.setStartY(scale(DIAGRAM_HEIGHT, scaleFactor, additional)); curve.setStartY(scale(getDiagramHeight(), scaleFactor, additional));
curve.setEndX(width); 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.setControlX1(scale(width, 0.2, 0));
curve.setControlY1(curve.getStartY()); curve.setControlY1(curve.getStartY());
@ -320,12 +323,12 @@ public class TransactionDiagram extends GridPane {
curve.getStyleClass().add("output-line"); curve.getStyleClass().add("output-line");
curve.setStartX(0); curve.setStartX(0);
curve.setStartY(scale(DIAGRAM_HEIGHT, 0.5, 0)); curve.setStartY(scale(getDiagramHeight(), 0.5, 0));
curve.setEndX(width); curve.setEndX(width);
double scaleFactor = (double)i / (numOutputs + 1); double scaleFactor = (double)i / (numOutputs + 1);
int nodeHeight = 20; int nodeHeight = 20;
double additional = (0.5 - scaleFactor) * ((double)nodeHeight); 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.setControlX1(scale(width, 0.2, 0));
curve.controlY1Property().bind(curve.startYProperty()); curve.controlY1Property().bind(curve.startYProperty());
@ -404,6 +407,18 @@ public class TransactionDiagram extends GridPane {
return txPane; 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() { 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

@ -64,6 +64,7 @@ public class TransactionController implements Initializable {
public void initializeView() { public void initializeView() {
initializeTxTree(); initializeTxTree();
transactionMasterDetail.setDividerPosition(0.82);
transactionMasterDetail.setShowDetailNode(Config.get().isShowTransactionHex()); transactionMasterDetail.setShowDetailNode(Config.get().isShowTransactionHex());
txhex.setTransaction(getTransaction()); txhex.setTransaction(getTransaction());
highlightTxHex(); highlightTxHex();

View file

@ -337,6 +337,10 @@ public class SendController extends WalletFormController implements Initializabl
transactionDiagram.update(walletTransaction); transactionDiagram.update(walletTransaction);
createButton.setDisable(walletTransaction == null || isInsufficientFeeRate()); createButton.setDisable(walletTransaction == null || isInsufficientFeeRate());
}); });
Platform.runLater(() -> {
transactionDiagram.update(null);
});
} }
private void initializeTabHeader(int count) { private void initializeTabHeader(int count) {

View file

@ -65,10 +65,6 @@
-fx-alignment: center-left; -fx-alignment: center-left;
} }
#transactionDiagram {
-fx-min-height: 215px;
}
#transactionDiagram .boundary { #transactionDiagram .boundary {
-fx-stroke: transparent; -fx-stroke: transparent;
} }

View file

@ -127,7 +127,7 @@
</AnchorPane> </AnchorPane>
</GridPane> </GridPane>
<AnchorPane> <AnchorPane>
<TransactionDiagram fx:id="transactionDiagram" maxWidth="700" maxHeight="215" AnchorPane.leftAnchor="100" /> <TransactionDiagram fx:id="transactionDiagram" maxWidth="700" AnchorPane.leftAnchor="100" />
</AnchorPane> </AnchorPane>
</VBox> </VBox>
</center> </center>