File tree 4 files changed +13
-13
lines changed
4 files changed +13
-13
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,10 @@ export class ClipModel {
8
8
forceForward : boolean ;
9
9
forceBackward : boolean ;
10
10
11
+ get force ( ) : boolean {
12
+ return this . forceForward || this . forceBackward ;
13
+ }
14
+
11
15
private infinite : boolean
12
16
13
17
constructor ( ) {
@@ -19,6 +23,10 @@ export class ClipModel {
19
23
20
24
reset ( ) {
21
25
this . doClip = false ;
26
+ this . forceReset ( ) ;
27
+ }
28
+
29
+ forceReset ( ) {
22
30
this . simulate = false ;
23
31
this . forceForward = false ;
24
32
this . forceBackward = false ;
Original file line number Diff line number Diff line change @@ -35,24 +35,18 @@ export default class Clip {
35
35
paddings . backward . size += item . size ;
36
36
}
37
37
clipped . push ( item . $index ) ;
38
- if ( clip . simulate ) {
38
+ if ( clip . simulate && ! clip . force ) {
39
39
buffer . removeItem ( item ) ;
40
40
}
41
41
return false ;
42
42
}
43
43
return true ;
44
44
} ) ;
45
- // if (size.backward) {
46
- // paddings.forward.size += size.backward;
47
- // }
48
- // if (size.forward) {
49
- // paddings.backward.size += size.forward;
50
- // }
51
45
logger . log ( ( ) => [
52
46
`clipped ${ clipped . length } items` +
53
- ( size . backward ? `, +${ size . backward } fwd px, ` : '' ) +
54
- ( size . forward ? `, +${ size . forward } bwd px, ` : '' ) ,
55
- `range: [${ clipped [ 0 ] } ..${ clipped [ clipped . length - 1 ] } ]`
47
+ ( size . backward ? `, +${ size . backward } fwd px` : '' ) +
48
+ ( size . forward ? `, +${ size . forward } bwd px` : '' ) +
49
+ `, range: [${ clipped [ 0 ] } ..${ clipped [ clipped . length - 1 ] } ]`
56
50
] ) ;
57
51
logger . stat ( 'after clip' ) ;
58
52
}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ export default class End {
47
47
state . isInitialLoop = false ;
48
48
state . fetch . simulate = false ;
49
49
clip . noClip = scroller . settings . infinite || ( next && clip . simulate ) ;
50
- clip . simulate = false ;
50
+ clip . forceReset ( ) ;
51
51
state . lastPosition = scroller . viewport . scrollPosition ;
52
52
scroller . purgeInnerLoopSubscriptions ( ) ;
53
53
}
Original file line number Diff line number Diff line change @@ -6,8 +6,6 @@ export default class UserClip {
6
6
static run ( scroller : Scroller , options ?: ClipOptions ) {
7
7
const _options = UserClip . checkOptions ( options ) ;
8
8
9
- scroller . state . clip . simulate = true ;
10
- scroller . state . clip . doClip = true ;
11
9
scroller . state . clip . forceForward = ! _options . backwardOnly ;
12
10
scroller . state . clip . forceBackward = ! _options . forwardOnly ;
13
11
You can’t perform that action at this time.
0 commit comments