File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -158,10 +158,10 @@ class Adapter {
158
158
if ( angular . isArray ( newItems ) && ! newItems . length ) {
159
159
var isTop = index === this . buffer . minIndex ;
160
160
if ( isTop ) {
161
- this . buffer . minIndex ++ ;
161
+ this . buffer . incrementMinIndex ( ) ;
162
162
}
163
163
else {
164
- this . buffer . maxIndex -- ;
164
+ this . buffer . decrementMinIndex ( ) ;
165
165
}
166
166
this . viewport . removeCacheItem ( index , isTop ) ;
167
167
}
Original file line number Diff line number Diff line change @@ -78,9 +78,15 @@ export default function ScrollBuffer(elementRoutines, bufferSize) {
78
78
// removes single item(wrapper) from the buffer
79
79
buffer . splice ( buffer . indexOf ( arg1 ) , 1 ) ;
80
80
if ( arg1 . _op === 'isTop' ) {
81
+ if ( buffer . first === buffer . minIndex ) {
82
+ this . incrementMinIndex ( ) ;
83
+ }
81
84
buffer . first ++ ;
82
85
}
83
86
else {
87
+ if ( buffer . next === buffer . maxIndex + 1 ) {
88
+ this . decrementMinIndex ( ) ;
89
+ }
84
90
buffer . next -- ;
85
91
}
86
92
if ( ! buffer . length ) {
@@ -91,6 +97,18 @@ export default function ScrollBuffer(elementRoutines, bufferSize) {
91
97
return elementRoutines . removeElementAnimated ( arg1 ) ;
92
98
} ,
93
99
100
+ incrementMinIndex ( ) {
101
+ if ( buffer . minIndex ++ === buffer . minIndexUser ) {
102
+ buffer . minIndexUser ++ ;
103
+ }
104
+ } ,
105
+
106
+ decrementMinIndex ( ) {
107
+ if ( buffer . maxIndex -- === buffer . maxIndexUser ) {
108
+ buffer . maxIndexUser -- ;
109
+ }
110
+ } ,
111
+
94
112
effectiveHeight ( elements ) {
95
113
if ( ! elements . length ) {
96
114
return 0 ;
You can’t perform that action at this time.
0 commit comments