When opening a chat holding unread messages, it scrolls to the first one
This commit is contained in:
parent
9111880dcf
commit
b5e83272a6
@ -232,7 +232,7 @@ public final class ChatScene implements Restorable {
|
|||||||
currentChat = localDB.getChat(user.getID()).get();
|
currentChat = localDB.getChat(user.getID()).get();
|
||||||
|
|
||||||
messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
|
messageList.setItems(FXCollections.observableList(currentChat.getMessages()));
|
||||||
final var scrollIndex = messageList.getItems().size() - 1;
|
final var scrollIndex = messageList.getItems().size() - currentChat.getUnreadAmount() - 1;
|
||||||
messageList.scrollTo(scrollIndex);
|
messageList.scrollTo(scrollIndex);
|
||||||
logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
|
logger.log(Level.FINEST, "Loading chat with " + user + " at index " + scrollIndex);
|
||||||
deleteContactMenuItem.setText("Delete " + user.getName());
|
deleteContactMenuItem.setText("Delete " + user.getName());
|
||||||
|
Reference in New Issue
Block a user