fix(files): Do not scroll if there is no scrolling area

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/42993/head
Ferdinand Thiessen 2024-01-31 20:11:58 +07:00
parent d7d1bb6c80
commit 99bc452675
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
1 changed files with 5 additions and 0 deletions

@ -243,6 +243,11 @@ export default Vue.extend({
methods: {
scrollTo(index: number) {
const targetRow = Math.ceil(this.dataSources.length / this.columnCount)
if (targetRow < this.rowCount) {
logger.debug('VirtualList: Skip scrolling. nothing to scroll', { index, targetRow, rowCount: this.rowCount })
return
}
this.index = index
// Scroll to one row and a half before the index
const scrollTop = (Math.floor(index / this.columnCount) - 0.5) * this.itemHeight + this.beforeHeight