@@ -18,29 +18,33 @@ export default class PreClip {
18
18
}
19
19
20
20
static prepareClip ( scroller : Scroller ) {
21
- const { state : { fetch, fetch : { direction } } } = scroller ;
21
+ const { state : { fetch, clip } } = scroller ;
22
22
if ( PreClip . shouldNotClip ( scroller ) ) {
23
23
return ;
24
24
}
25
25
const firstIndex = fetch . first . indexBuffer as number ;
26
26
const lastIndex = fetch . last . indexBuffer as number ;
27
27
scroller . logger . log ( ( ) =>
28
- `looking for ${ direction ? 'anti-' + direction + ' ' : '' } items ` +
28
+ `looking for ${ fetch . direction ? 'anti-' + fetch . direction + ' ' : '' } items ` +
29
29
`that are out of [${ firstIndex } ..${ lastIndex } ] range` ) ;
30
30
if ( PreClip . isBackward ( scroller , firstIndex ) ) {
31
31
PreClip . prepareClipByDirection ( scroller , Direction . backward , firstIndex ) ;
32
32
}
33
33
if ( PreClip . isForward ( scroller , lastIndex ) ) {
34
34
PreClip . prepareClipByDirection ( scroller , Direction . forward , lastIndex ) ;
35
35
}
36
- if ( ! scroller . state . clip . doClip ) {
36
+ if ( ! clip . doClip ) {
37
37
scroller . logger . log ( `skipping clip [no items to clip]` ) ;
38
38
}
39
39
return ;
40
40
}
41
41
42
42
static shouldNotClip ( scroller : Scroller ) : boolean {
43
- const { buffer, state } = scroller ;
43
+ const { settings, buffer, state } = scroller ;
44
+ if ( settings . infinite ) {
45
+ scroller . logger . log ( `skipping clip [infinite mode]` ) ;
46
+ return true ;
47
+ }
44
48
if ( ! buffer . size ) {
45
49
scroller . logger . log ( `skipping clip [empty buffer]` ) ;
46
50
return true ;
0 commit comments