mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
fix (virtual): virtual scroll in fileviewer
there was an issue from a page viewer virtual scroll enabled typing a search that would return a small amount of result with a scrollbar. in those condition the scroll event would still be called with the previous incorrect data
This commit is contained in:
parent
0a2f3c6b3c
commit
23c5bf53f5
1 changed files with 9 additions and 3 deletions
|
|
@ -137,7 +137,7 @@ export default async function(render) {
|
||||||
/// ///////////////////////////////////
|
/// ///////////////////////////////////
|
||||||
// CASE 1: virtual scroll isn't enabled
|
// CASE 1: virtual scroll isn't enabled
|
||||||
if (files.length <= VIRTUAL_SCROLL_MINIMUM_TRIGGER) {
|
if (files.length <= VIRTUAL_SCROLL_MINIMUM_TRIGGER) {
|
||||||
return rxjs.EMPTY;
|
return rxjs.of({ virtual: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ///////////////////////////////////
|
/// ///////////////////////////////////
|
||||||
|
|
@ -157,6 +157,7 @@ export default async function(render) {
|
||||||
setHeight(0);
|
setHeight(0);
|
||||||
const top = ($node) => $node.getBoundingClientRect().top;
|
const top = ($node) => $node.getBoundingClientRect().top;
|
||||||
return rxjs.of({
|
return rxjs.of({
|
||||||
|
virtual: true,
|
||||||
files,
|
files,
|
||||||
read_only,
|
read_only,
|
||||||
path,
|
path,
|
||||||
|
|
@ -176,9 +177,14 @@ export default async function(render) {
|
||||||
BLOCK_SIZE, COLUMN_PER_ROW, FILE_HEIGHT,
|
BLOCK_SIZE, COLUMN_PER_ROW, FILE_HEIGHT,
|
||||||
MARGIN,
|
MARGIN,
|
||||||
currentState,
|
currentState,
|
||||||
/* height, */ setHeight,
|
setHeight,
|
||||||
$list,
|
$list,
|
||||||
}) => rxjs.fromEvent($page.closest(".scroll-y"), "scroll", { passive: true }).pipe(
|
virtual,
|
||||||
|
}) => (
|
||||||
|
virtual ?
|
||||||
|
rxjs.fromEvent($page.closest(".scroll-y"), "scroll", { passive: true }) :
|
||||||
|
rxjs.EMPTY
|
||||||
|
).pipe(
|
||||||
rxjs.map((e) => {
|
rxjs.map((e) => {
|
||||||
// 0-------------0-----------1-----------2-----------3 ....
|
// 0-------------0-----------1-----------2-----------3 ....
|
||||||
// [padding] $block1 $block2 $block3 ....
|
// [padding] $block1 $block2 $block3 ....
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue