@@ -818,7 +818,7 @@ export class Content extends Ion implements OnDestroy, OnInit {
818818 */
819819 imgsUpdate ( ) {
820820 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 ) ;
822822 }
823823 }
824824
@@ -833,14 +833,14 @@ export class Content extends Ion implements OnDestroy, OnInit {
833833
834834}
835835
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 ) {
837837 // ok, so it's time to see which images, if any, should be requested and rendered
838838 // ultimately, if we're scrolling fast then don't bother requesting or rendering
839839 // when scrolling is done, then it needs to do a check to see which images are
840840 // important to request and render, and which image requests should be aborted.
841841 // Additionally, images which are not near the viewable area should not be
842842 // rendered at all in order to save browser resources.
843- const scrollBottom = ( scrollTop + scrollHeight ) ;
843+ const viewableBottom = ( viewableTop + contentHeight ) ;
844844 const priority1 : Img [ ] = [ ] ;
845845 const priority2 : Img [ ] = [ ] ;
846846 let img : Img ;
@@ -851,23 +851,23 @@ export function updateImgs(imgs: Img[], scrollTop: number, scrollHeight: number,
851851
852852 if ( scrollDirectionY === 'up' ) {
853853 // scrolling up
854- if ( img . top < scrollBottom && img . bottom > scrollTop - renderableBuffer ) {
854+ if ( img . top < viewableBottom && img . bottom > viewableTop - renderableBuffer ) {
855855 // scrolling up, img is within viewable area
856856 // or about to be viewable area
857857 img . canRequest = img . canRender = true ;
858858 priority1 . push ( img ) ;
859859 continue ;
860860 }
861861
862- if ( img . bottom <= scrollTop && img . bottom > scrollTop - requestableBuffer ) {
862+ if ( img . bottom <= viewableTop && img . bottom > viewableTop - requestableBuffer ) {
863863 // scrolling up, img is within requestable area
864864 img . canRequest = true ;
865865 img . canRender = false ;
866866 priority2 . push ( img ) ;
867867 continue ;
868868 }
869869
870- if ( img . top >= scrollBottom && img . top < scrollBottom + renderableBuffer ) {
870+ if ( img . top >= viewableBottom && img . top < viewableBottom + renderableBuffer ) {
871871 // scrolling up, img below viewable area
872872 // but it's still within renderable area
873873 // don't allow a reset
@@ -878,23 +878,23 @@ export function updateImgs(imgs: Img[], scrollTop: number, scrollHeight: number,
878878 } else {
879879 // scrolling down
880880
881- if ( img . bottom > scrollTop && img . top < scrollBottom + renderableBuffer ) {
881+ if ( img . bottom > viewableTop && img . top < viewableBottom + renderableBuffer ) {
882882 // scrolling down, img is within viewable area
883883 // or about to be viewable area
884884 img . canRequest = img . canRender = true ;
885885 priority1 . push ( img ) ;
886886 continue ;
887887 }
888888
889- if ( img . top >= scrollBottom && img . top < scrollBottom + requestableBuffer ) {
889+ if ( img . top >= viewableBottom && img . top < viewableBottom + requestableBuffer ) {
890890 // scrolling down, img is within requestable area
891891 img . canRequest = true ;
892892 img . canRender = false ;
893893 priority2 . push ( img ) ;
894894 continue ;
895895 }
896896
897- if ( img . bottom <= scrollTop && img . bottom > scrollTop - renderableBuffer ) {
897+ if ( img . bottom <= viewableTop && img . bottom > viewableTop - renderableBuffer ) {
898898 // scrolling down, img above viewable area
899899 // but it's still within renderable area
900900 // don't allow a reset
0 commit comments