#69 : Update adjacent indexes

This commit is contained in:
Vadim
2021-09-09 21:35:54 +03:00
parent 7a410045f8
commit f830b69bea
2 changed files with 21 additions and 25 deletions

View File

@@ -199,6 +199,7 @@
// used for lazy loading images, preloaded only current, adjacent and cloanable images
$: loaded = getAdjacentIndexes({
infinite,
scrollIndex: currentScrollIndex,
scrollsCount,
pagesCount: pagesCountWithoutClones,
@@ -276,28 +277,7 @@
pagesToShow,
pagesCountWithoutClones,
})
// load first and last child to clone them
scrollsCount = getScrollsCount({
infinite,
pagesCountWithoutClones,
pagesToScroll,
})
loaded = [
...getIndexesOfPagesWithoutClonesInScroll({
scrollIndex: 0,
pagesToShow,
pagesToScroll,
pagesCount: pagesCountWithoutClones,
}),
...getIndexesOfPagesWithoutClonesInScroll({
scrollIndex: scrollsCount - 1,
pagesToShow,
pagesToScroll,
pagesCount: pagesCountWithoutClones,
}),
]
await tick()
infinite && addClones()