@@ -87,15 +87,12 @@ export class TilesRendererBase {
8787
8888 }
8989
90- set loadSiblings ( v ) {
90+ get loadProgress ( ) {
9191
92- console . warn ( 'TilesRenderer: "loadSiblings" option has been removed.' ) ;
93-
94- }
95-
96- set stopAtEmptyTiles ( v ) {
97-
98- console . warn ( 'TilesRenderer: "stopAtEmptyTiles" option has been removed.' ) ;
92+ const stats = this . stats ;
93+ const loading = stats . downloading + stats . parsing ;
94+ const total = stats . inCacheSinceLoad ;
95+ return total === 0 ? 1.0 : 1.0 - loading / total ;
9996
10097 }
10198
@@ -108,6 +105,7 @@ export class TilesRendererBase {
108105 this . fetchOptions = { } ;
109106 this . plugins = [ ] ;
110107 this . queuedTiles = [ ] ;
108+ this . cachedSinceLoadComplete = new Set ( ) ;
111109
112110 const lruCache = new LRUCache ( ) ;
113111 lruCache . unloadPriorityCallback = lruPriorityCallback ;
@@ -125,6 +123,7 @@ export class TilesRendererBase {
125123 this . downloadQueue = downloadQueue ;
126124 this . parseQueue = parseQueue ;
127125 this . stats = {
126+ inCacheSinceLoad : 0 ,
128127 inCache : 0 ,
129128 parsing : 0 ,
130129 downloading : 0 ,
@@ -642,6 +641,13 @@ export class TilesRendererBase {
642641
643642 // Decrement stats
644643 stats . inCache -- ;
644+ if ( this . cachedSinceLoadComplete . has ( tile ) ) {
645+
646+ this . cachedSinceLoadComplete . delete ( tile ) ;
647+ stats . inCacheSinceLoad -- ;
648+
649+ }
650+
645651 if ( t . __loadingState === LOADING ) {
646652
647653 stats . downloading -- ;
@@ -666,6 +672,8 @@ export class TilesRendererBase {
666672
667673 }
668674
675+ this . cachedSinceLoadComplete . add ( tile ) ;
676+ stats . inCacheSinceLoad ++ ;
669677 stats . inCache ++ ;
670678 stats . downloading ++ ;
671679 tile . __loadingState = LOADING ;
@@ -809,6 +817,16 @@ export class TilesRendererBase {
809817
810818 }
811819
820+ } )
821+ . finally ( ( ) => {
822+
823+ if ( stats . parsing === 0 && stats . downloading === 0 ) {
824+
825+ this . cachedSinceLoadComplete . clear ( ) ;
826+ stats . inCacheSinceLoad = 0 ;
827+
828+ }
829+
812830 } ) ;
813831
814832 }
0 commit comments