From e0b9c572ecc64903ac67509add488e6e0f38e761 Mon Sep 17 00:00:00 2001 From: axpoems <145597137+axpoems@users.noreply.github.com> Date: Sat, 7 Sep 2024 20:13:13 +0200 Subject: [PATCH] Only show vertical scrollbar if not enough space --- .../reactions_box/ReactionUsersPopup.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/reactions_box/ReactionUsersPopup.java b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/reactions_box/ReactionUsersPopup.java index 56c3e2df65..e5ac0890e7 100644 --- a/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/reactions_box/ReactionUsersPopup.java +++ b/apps/desktop/desktop/src/main/java/bisq/desktop/main/content/chat/message_container/list/reactions_box/ReactionUsersPopup.java @@ -30,7 +30,12 @@ import javafx.geometry.Bounds; import javafx.geometry.Pos; import javafx.scene.Node; -import javafx.scene.control.*; +import javafx.scene.control.ContentDisplay; +import javafx.scene.control.Label; +import javafx.scene.control.ListCell; +import javafx.scene.control.ListView; +import javafx.scene.control.PopupControl; +import javafx.scene.control.Skin; import javafx.scene.image.ImageView; import javafx.scene.layout.HBox; import javafx.scene.layout.StackPane; @@ -101,6 +106,8 @@ private void initialize() { hide(); } }); + + maybeHideScrollbar(); } private void showPopup() { @@ -142,6 +149,17 @@ private boolean hasMouseExited(double mouseX, double mouseY) { return !(inPopupBounds || inAreaBetweenButtonAndPopup); } + private void maybeHideScrollbar() { + String hideScrollbarClass = "hide-vertical-scrollbar"; + if (userProfileListView.getItems().size() <= MAX_USERS_SHOWN_AT_THE_SAME_TIME) { + if (!userProfileListView.getStyleClass().contains(hideScrollbarClass)) { + userProfileListView.getStyleClass().add(hideScrollbarClass); + } + } else { + userProfileListView.getStyleClass().remove(hideScrollbarClass); + } + } + private Callback, ListCell> getCellFactory() { return new Callback<>() { @Override