From 2b4c17be5689218ae8b2f9aa7d5cf7f8298a3f94 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 5 Jun 2017 11:25:04 +0200 Subject: [PATCH] fix(ui/modules/Linphone/Chat/Chat): use a timeout to scroll at end --- linphone-desktop/ui/modules/Linphone/Chat/Chat.js | 10 ---------- linphone-desktop/ui/modules/Linphone/Chat/Chat.qml | 13 ++++++++++++- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/linphone-desktop/ui/modules/Linphone/Chat/Chat.js b/linphone-desktop/ui/modules/Linphone/Chat/Chat.js index bc81f119f..c2fe755f3 100644 --- a/linphone-desktop/ui/modules/Linphone/Chat/Chat.js +++ b/linphone-desktop/ui/modules/Linphone/Chat/Chat.js @@ -5,7 +5,6 @@ function initView () { chat.tryToLoadMoreEntries = false chat.bindToEnd = true - chat.positionViewAtEnd() } function loadMoreEntries () { @@ -48,15 +47,6 @@ function handleMovementStarted () { chat.bindToEnd = false } -function handleDataChanged (_, bottomRight) { - var n = chat.count - var index = bottomRight.row - - if (chat.bindToEnd && index + 1 === n) { - chat.positionViewAtEnd() - } -} - function sendMessage (text) { textArea.text = '' chat.bindToEnd = true diff --git a/linphone-desktop/ui/modules/Linphone/Chat/Chat.qml b/linphone-desktop/ui/modules/Linphone/Chat/Chat.qml index f1a137da5..43e09a180 100644 --- a/linphone-desktop/ui/modules/Linphone/Chat/Chat.qml +++ b/linphone-desktop/ui/modules/Linphone/Chat/Chat.qml @@ -65,7 +65,6 @@ Rectangle { // more entries. onEntryTypeFilterChanged: Logic.initView() onMoreEntriesLoaded: Logic.handleMoreEntriesLoaded(n) - onDataChanged: Logic.handleDataChanged(topLeft, bottomRight) } // ----------------------------------------------------------------------- @@ -209,4 +208,16 @@ Rectangle { } } } + + // --------------------------------------------------------------------------- + // Scroll at end if necessary. + // --------------------------------------------------------------------------- + + Timer { + interval: 100 + repeat: true + running: true + + onTriggered: chat.bindToEnd && chat.positionViewAtEnd() + } }