@@ -158,15 +158,19 @@ export class Content extends Ion implements OnDestroy, OnInit {
158
158
/** @internal */
159
159
_fullscreen : boolean ;
160
160
/** @internal */
161
- _imgs : Img [ ] = [ ] ;
162
- /** @internal */
163
161
_footerEle : HTMLElement ;
164
162
/** @internal */
165
163
_dirty : boolean ;
166
164
/** @internal */
167
165
_scrollEle : HTMLElement ;
168
166
/** @internal */
169
167
_fixedEle : HTMLElement ;
168
+ /** @internal */
169
+ _imgs : Img [ ] = [ ] ;
170
+
171
+ private _imgReqBfr : number ;
172
+ private _imgRndBfr : number ;
173
+ private _imgVelMax : number ;
170
174
171
175
/** @private */
172
176
statusbarPadding : boolean ;
@@ -263,24 +267,6 @@ export class Content extends Ion implements OnDestroy, OnInit {
263
267
return this . _scroll . isScrolling ;
264
268
}
265
269
266
- /**
267
- * The current vertical scroll velocity.
268
- *
269
- * @return {number }
270
- */
271
- get velocityY ( ) : number {
272
- return this . _scroll . ev . velocityY ;
273
- }
274
-
275
- /**
276
- * The current horizontal scroll velocity.
277
- *
278
- * @return {number }
279
- */
280
- get velocityX ( ) : number {
281
- return this . _scroll . ev . velocityX ;
282
- }
283
-
284
270
/**
285
271
* The current, or last known, vertical scroll direction. Possible
286
272
* string values include `down` and `up`.
@@ -341,6 +327,9 @@ export class Content extends Ion implements OnDestroy, OnInit {
341
327
super ( config , elementRef , renderer , 'content' ) ;
342
328
343
329
this . statusbarPadding = config . getBoolean ( 'statusbarPadding' , false ) ;
330
+ this . _imgReqBfr = config . getNumber ( 'imgRequestBuffer' , 1400 ) ;
331
+ this . _imgRndBfr = config . getNumber ( 'imgRenderBuffer' , 400 ) ;
332
+ this . _imgVelMax = config . getNumber ( 'imgVelocityMax' , 3 ) ;
344
333
345
334
if ( viewCtrl ) {
346
335
viewCtrl . _setIONContent ( this ) ;
@@ -818,17 +807,20 @@ export class Content extends Ion implements OnDestroy, OnInit {
818
807
*/
819
808
imgsUpdate ( ) {
820
809
if ( this . _scroll . initialized && this . _imgs . length && this . isImgsUpdatable ( ) ) {
821
- updateImgs ( this . _imgs , this . scrollTop , this . contentHeight , this . directionY , IMG_REQUESTABLE_BUFFER , IMG_RENDERABLE_BUFFER ) ;
810
+ updateImgs ( this . _imgs , this . scrollTop , this . contentHeight , this . directionY , this . _imgReqBfr , this . _imgRndBfr ) ;
822
811
}
823
812
}
824
813
825
814
/**
826
815
* @private
827
816
*/
828
817
isImgsUpdatable ( ) {
829
- // an image is only "updatable" if the content
830
- // isn't scrolling too fast
831
- return Math . abs ( this . velocityY ) < 3 ;
818
+ // an image is only "updatable" if the content isn't scrolling too fast
819
+ // if scroll speed is above the maximum velocity, then let current
820
+ // requests finish, but do not start new requets or render anything
821
+ // if scroll speed is below the maximum velocity, then it's ok
822
+ // to start new requests and render images
823
+ return Math . abs ( this . _scroll . ev . velocityY ) < this . _imgVelMax ;
832
824
}
833
825
834
826
}
@@ -920,9 +912,6 @@ export function updateImgs(imgs: Img[], viewableTop: number, contentHeight: numb
920
912
}
921
913
}
922
914
923
- const IMG_REQUESTABLE_BUFFER = 1200 ;
924
- const IMG_RENDERABLE_BUFFER = 300 ;
925
-
926
915
927
916
function sortTopToBottom ( a : Img , b : Img ) {
928
917
if ( a . top < b . top ) {
0 commit comments