@@ -2031,9 +2031,7 @@ export class Map extends Camera {
20312031 if ( this . painter . renderToTexture ) this . painter . renderToTexture . destruct ( ) ;
20322032 this . painter . renderToTexture = null ;
20332033 this . transform . setMinElevationForCurrentTile ( 0 ) ;
2034- if ( this . transform . pitch <= 89 ) {
2035- this . transform . setElevation ( 0 ) ;
2036- }
2034+ this . transform . setElevationIfCenterPointBelowHorizon ( 0 ) ;
20372035 } else {
20382036 // add terrain
20392037 const sourceCache = this . style . sourceCaches [ options . source ] ;
@@ -2057,9 +2055,7 @@ export class Map extends Camera {
20572055 } else if ( e . dataType === 'source' && e . tile ) {
20582056 if ( e . sourceId === options . source && ! this . _elevationFreeze ) {
20592057 this . transform . setMinElevationForCurrentTile ( this . terrain . getMinTileElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
2060- if ( this . transform . pitch <= 89 ) {
2061- this . transform . setElevation ( this . terrain . getElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
2062- }
2058+ this . transform . setElevationIfCenterPointBelowHorizon ( this . terrain . getElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
20632059 }
20642060 this . terrain . sourceCache . freeRtt ( e . tile . tileID ) ;
20652061 }
@@ -3205,14 +3201,12 @@ export class Map extends Camera {
32053201 if ( this . terrain ) {
32063202 this . terrain . sourceCache . update ( this . transform , this . terrain ) ;
32073203 this . transform . setMinElevationForCurrentTile ( this . terrain . getMinTileElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
3208- if ( ! this . _elevationFreeze && this . transform . pitch <= 89 ) {
3209- this . transform . setElevation ( this . terrain . getElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
3204+ if ( ! this . _elevationFreeze ) {
3205+ this . transform . setElevationIfCenterPointBelowHorizon ( this . terrain . getElevationForLngLatZoom ( this . transform . center , this . transform . tileZoom ) ) ;
32103206 }
32113207 } else {
32123208 this . transform . setMinElevationForCurrentTile ( 0 ) ;
3213- if ( this . transform . pitch <= 89 ) {
3214- this . transform . setElevation ( 0 ) ;
3215- }
3209+ this . transform . setElevationIfCenterPointBelowHorizon ( 0 ) ;
32163210 }
32173211
32183212 this . _placementDirty = this . style && this . style . _updatePlacement ( this . transform , this . showCollisionBoxes , fadeDuration , this . _crossSourceCollisions , transformUpdateResult . forcePlacementUpdate ) ;
0 commit comments