fix(ui/modules/Linphone/Chat/Chat): use a timeout to scroll at end

This commit is contained in:
Ronan Abhamon 2017-06-05 11:25:04 +02:00
parent 1472adcb55
commit 2b4c17be56
2 changed files with 12 additions and 11 deletions

View file

@ -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

View file

@ -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()
}
}