@@ -126,28 +126,31 @@ class TileLayer extends Layer {
126126 const mapExtent = map . getContainerExtent ( ) ;
127127 const tileGrids = [ ] ;
128128 let count = 0 ;
129+ const minZoom = this . getMinZoom ( ) ;
129130 const minPitchToCascade = this . options [ 'minPitchToCascade' ] ;
130- if ( ! isNil ( z ) || ! this . options [ 'cascadeTiles' ] || map . getPitch ( ) <= minPitchToCascade ) {
131- if ( isNil ( z ) ) {
132- z = this . _getTileZoom ( map . getZoom ( ) ) ;
133- }
134- const currentTiles = this . _getTiles ( z , mapExtent ) ;
131+ const tileZoom = isNil ( z ) ? this . _getTileZoom ( map . getZoom ( ) ) : z ;
132+ if (
133+ ! isNil ( z ) ||
134+ ! this . options [ 'cascadeTiles' ] ||
135+ map . getPitch ( ) <= minPitchToCascade ||
136+ ! isNil ( minZoom ) && tileZoom <= minZoom
137+ ) {
138+ const currentTiles = this . _getTiles ( tileZoom , mapExtent ) ;
135139 count += currentTiles ? currentTiles . tiles . length : 0 ;
136140 tileGrids . push ( currentTiles ) ;
137141 return {
138142 tileGrids, count
139143 } ;
140144 }
141145
142- z = this . _getTileZoom ( map . getZoom ( ) ) ;
143146 const visualHeight = Math . floor ( map . _getVisualHeight ( minPitchToCascade ) ) ;
144147 const extent0 = new PointExtent ( 0 , map . height - visualHeight , map . width , map . height ) ;
145- const currentTiles = this . _getTiles ( z , extent0 , 0 ) ;
148+ const currentTiles = this . _getTiles ( tileZoom , extent0 , 0 ) ;
146149 count += currentTiles ? currentTiles . tiles . length : 0 ;
147150
148151 const extent1 = new PointExtent ( 0 , mapExtent . ymin , map . width , extent0 . ymin ) ;
149152 const d = map . getSpatialReference ( ) . getZoomDirection ( ) ;
150- const parentTiles = this . _getTiles ( z - d , extent1 , 1 ) ;
153+ const parentTiles = this . _getTiles ( tileZoom - d , extent1 , 1 ) ;
151154 count += parentTiles ? parentTiles . tiles . length : 0 ;
152155
153156 tileGrids . push ( currentTiles , parentTiles ) ;
@@ -269,7 +272,12 @@ class TileLayer extends Layer {
269272 if ( ! map || ! this . isVisible ( ) || ! map . width || ! map . height ) {
270273 return null ;
271274 }
272-
275+ const minZoom = this . getMinZoom ( ) ,
276+ maxZoom = this . getMaxZoom ( ) ;
277+ if ( ! isNil ( minZoom ) && z < minZoom ||
278+ ! isNil ( maxZoom ) && z > maxZoom ) {
279+ return null ;
280+ }
273281 const tileConfig = this . _getTileConfig ( ) ;
274282 if ( ! tileConfig ) {
275283 return null ;
0 commit comments