@@ -818,7 +818,7 @@ export class Content extends Ion implements OnDestroy, OnInit {
818
818
*/
819
819
imgsUpdate ( ) {
820
820
if ( this . _scroll . initialized && this . _imgs . length && this . isImgsUpdatable ( ) ) {
821
- updateImgs ( this . _imgs , this . scrollTop , this . scrollHeight , this . directionY , IMG_REQUESTABLE_BUFFER , IMG_RENDERABLE_BUFFER ) ;
821
+ updateImgs ( this . _imgs , this . scrollTop , this . contentHeight , this . directionY , IMG_REQUESTABLE_BUFFER , IMG_RENDERABLE_BUFFER ) ;
822
822
}
823
823
}
824
824
@@ -833,14 +833,14 @@ export class Content extends Ion implements OnDestroy, OnInit {
833
833
834
834
}
835
835
836
- export function updateImgs ( imgs : Img [ ] , scrollTop : number , scrollHeight : number , scrollDirectionY : string , requestableBuffer : number , renderableBuffer : number ) {
836
+ export function updateImgs ( imgs : Img [ ] , viewableTop : number , contentHeight : number , scrollDirectionY : string , requestableBuffer : number , renderableBuffer : number ) {
837
837
// ok, so it's time to see which images, if any, should be requested and rendered
838
838
// ultimately, if we're scrolling fast then don't bother requesting or rendering
839
839
// when scrolling is done, then it needs to do a check to see which images are
840
840
// important to request and render, and which image requests should be aborted.
841
841
// Additionally, images which are not near the viewable area should not be
842
842
// rendered at all in order to save browser resources.
843
- const scrollBottom = ( scrollTop + scrollHeight ) ;
843
+ const viewableBottom = ( viewableTop + contentHeight ) ;
844
844
const priority1 : Img [ ] = [ ] ;
845
845
const priority2 : Img [ ] = [ ] ;
846
846
let img : Img ;
@@ -851,23 +851,23 @@ export function updateImgs(imgs: Img[], scrollTop: number, scrollHeight: number,
851
851
852
852
if ( scrollDirectionY === 'up' ) {
853
853
// scrolling up
854
- if ( img . top < scrollBottom && img . bottom > scrollTop - renderableBuffer ) {
854
+ if ( img . top < viewableBottom && img . bottom > viewableTop - renderableBuffer ) {
855
855
// scrolling up, img is within viewable area
856
856
// or about to be viewable area
857
857
img . canRequest = img . canRender = true ;
858
858
priority1 . push ( img ) ;
859
859
continue ;
860
860
}
861
861
862
- if ( img . bottom <= scrollTop && img . bottom > scrollTop - requestableBuffer ) {
862
+ if ( img . bottom <= viewableTop && img . bottom > viewableTop - requestableBuffer ) {
863
863
// scrolling up, img is within requestable area
864
864
img . canRequest = true ;
865
865
img . canRender = false ;
866
866
priority2 . push ( img ) ;
867
867
continue ;
868
868
}
869
869
870
- if ( img . top >= scrollBottom && img . top < scrollBottom + renderableBuffer ) {
870
+ if ( img . top >= viewableBottom && img . top < viewableBottom + renderableBuffer ) {
871
871
// scrolling up, img below viewable area
872
872
// but it's still within renderable area
873
873
// don't allow a reset
@@ -878,23 +878,23 @@ export function updateImgs(imgs: Img[], scrollTop: number, scrollHeight: number,
878
878
} else {
879
879
// scrolling down
880
880
881
- if ( img . bottom > scrollTop && img . top < scrollBottom + renderableBuffer ) {
881
+ if ( img . bottom > viewableTop && img . top < viewableBottom + renderableBuffer ) {
882
882
// scrolling down, img is within viewable area
883
883
// or about to be viewable area
884
884
img . canRequest = img . canRender = true ;
885
885
priority1 . push ( img ) ;
886
886
continue ;
887
887
}
888
888
889
- if ( img . top >= scrollBottom && img . top < scrollBottom + requestableBuffer ) {
889
+ if ( img . top >= viewableBottom && img . top < viewableBottom + requestableBuffer ) {
890
890
// scrolling down, img is within requestable area
891
891
img . canRequest = true ;
892
892
img . canRender = false ;
893
893
priority2 . push ( img ) ;
894
894
continue ;
895
895
}
896
896
897
- if ( img . bottom <= scrollTop && img . bottom > scrollTop - renderableBuffer ) {
897
+ if ( img . bottom <= viewableTop && img . bottom > viewableTop - renderableBuffer ) {
898
898
// scrolling down, img above viewable area
899
899
// but it's still within renderable area
900
900
// don't allow a reset
0 commit comments