Fix virtual scrolling

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
Marcel Klehr 2022-07-02 18:08:54 +02:00
parent a6ab79a493
commit 60e06959d6
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ export default {
const viewport = this.$el.getBoundingClientRect()
itemHeight = this.viewMode === 'grid' ? GRID_ITEM_HEIGHT : LIST_ITEM_HEIGHT
itemsPerRow = this.viewMode === 'grid' ? Math.floor(viewport.width / GRID_ITEM_WIDTH) : 1
renderedItems = itemsPerRow * Math.floor((viewport.height + 2 * 500) / itemHeight)
renderedItems = itemsPerRow * (Math.floor((viewport.height) / itemHeight) + 2 * Math.floor(800 / itemHeight))
upperPaddingItems = itemsPerRow * Math.floor(Math.max(this.scrollTop - 500, 0) / itemHeight)
lowerPaddingItems = Math.max(this.$slots.default.length - renderedItems - upperPaddingItems, 0)
children = this.$slots.default.slice(upperPaddingItems, upperPaddingItems + renderedItems)