mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
fix(ui/modules/Linphone/Chat/Chat): use a timeout to scroll at end
This commit is contained in:
parent
1472adcb55
commit
2b4c17be56
2 changed files with 12 additions and 11 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue