minor fixes on recent blocks view

This commit is contained in:
Craig Raw 2025-05-21 10:05:58 +02:00
parent 58635801fc
commit b3c92617c9
2 changed files with 5 additions and 4 deletions

View file

@ -62,8 +62,9 @@ public class BlockCube extends Group {
this.medianFeeProperty.addListener((_, _, newValue) -> { this.medianFeeProperty.addListener((_, _, newValue) -> {
medianFeeText.setText(newValue.doubleValue() < 0.0d ? "" : "~" + Math.round(Math.max(newValue.doubleValue(), 1.0d))); medianFeeText.setText(newValue.doubleValue() < 0.0d ? "" : "~" + Math.round(Math.max(newValue.doubleValue(), 1.0d)));
unitsText.setText(newValue.doubleValue() < 0.0d ? "" : " s/vb"); unitsText.setText(newValue.doubleValue() < 0.0d ? "" : " s/vb");
double medianFeeWidth = TextUtils.computeTextWidth(medianFeeText.getFont(), medianFeeText.getText(), 0.0d);
double unitsWidth = TextUtils.computeTextWidth(unitsText.getFont(), unitsText.getText(), 0.0d); double unitsWidth = TextUtils.computeTextWidth(unitsText.getFont(), unitsText.getText(), 0.0d);
medianFeeTextFlow.setTranslateX((CUBE_SIZE - (medianFeeText.getLayoutBounds().getWidth() + unitsWidth)) / 2); medianFeeTextFlow.setTranslateX((CUBE_SIZE - (medianFeeWidth + unitsWidth)) / 2);
}); });
this.txCountProperty.addListener((_, _, newValue) -> { this.txCountProperty.addListener((_, _, newValue) -> {
txCountText.setText(newValue.intValue() == 0 ? "" : newValue + " txes"); txCountText.setText(newValue.intValue() == 0 ? "" : newValue + " txes");

View file

@ -91,12 +91,12 @@ public class RecentBlocksView extends Pane {
} else { } else {
for(int i = 1; i < getCubes().size() && i < latestBlocks.size(); i++) { for(int i = 1; i < getCubes().size() && i < latestBlocks.size(); i++) {
BlockCube blockCube = getCubes().get(i); BlockCube blockCube = getCubes().get(i);
BlockSummary latestBlock = latestBlocks.get(i); BlockSummary latestBlock = latestBlocks.get(i-1);
blockCube.setConfirmed(true); blockCube.setConfirmed(true);
blockCube.setHeight(latestBlock.getHeight()); blockCube.setHeight(latestBlock.getHeight());
blockCube.setTimestamp(latestBlock.getTimestamp().getTime()); blockCube.setTimestamp(latestBlock.getTimestamp().getTime());
blockCube.setWeight(latestBlock.getWeight().orElse(0)); blockCube.setWeight(latestBlock.getWeight().orElse(0));
blockCube.setMedianFee(latestBlock.getMedianFee().orElse(0.0d)); blockCube.setMedianFee(latestBlock.getMedianFee().orElse(-1.0d));
blockCube.setTxCount(latestBlock.getTransactionCount().orElse(0)); blockCube.setTxCount(latestBlock.getTransactionCount().orElse(0));
} }
updateFeeRate(currentFeeRate); updateFeeRate(currentFeeRate);
@ -116,7 +116,7 @@ public class RecentBlocksView extends Pane {
blockCube.setHeight(latestBlock.getHeight()); blockCube.setHeight(latestBlock.getHeight());
blockCube.setTimestamp(latestBlock.getTimestamp().getTime()); blockCube.setTimestamp(latestBlock.getTimestamp().getTime());
blockCube.setWeight(latestBlock.getWeight().orElse(0)); blockCube.setWeight(latestBlock.getWeight().orElse(0));
blockCube.setMedianFee(latestBlock.getMedianFee().orElse(0.0d)); blockCube.setMedianFee(latestBlock.getMedianFee().orElse(-1.0d));
blockCube.setTxCount(latestBlock.getTransactionCount().orElse(0)); blockCube.setTxCount(latestBlock.getTransactionCount().orElse(0));
} }