@@ -109,7 +109,7 @@ function _patchStyleWater(styleObj) {
109109 // Colors pre-compensated for canvas filter brightness(1.8) contrast(0.9).
110110 if ( _mapStyle === 'dark' ) {
111111 // Darker water for Dark Map
112- const waterColor = '#131619 ' ;
112+ const waterColor = '#17212b ' ;
113113 for ( const layer of styleObj . layers ) {
114114 if ( ! layer . paint ) layer . paint = { } ;
115115 if ( layer . type === 'fill' && / ^ w a t e r / . test ( layer . id ) ) {
@@ -357,10 +357,17 @@ function applyExtraLayers() {
357357
358358function apply3DBuildings ( ) {
359359 if ( ! map . getSource || ! map . getSource ( 'openmaptiles' ) ) return ;
360- const shouldShow = buildings3DVisible && ! [ 'satellite' , 'satellite3d' , 'terrain3d' , 'globe' ] . includes ( _mapStyle ) ;
361- if ( shouldShow && ! map . getLayer ( 'matrix-buildings-3d' ) ) {
362- // Insert below the first symbol layer so road/POI labels render on top of buildings
363- const firstSymbol = map . getStyle ( ) ?. layers ?. find ( l => l . type === 'symbol' ) ;
360+ const noBuildings = [ 'satellite' , 'satellite3d' , 'terrain3d' , 'globe' ] ;
361+ const shouldShow = buildings3DVisible && ! noBuildings . includes ( _mapStyle ) ;
362+ // Toggle the style's native fill-extrusion layers (OpenFreeMap styles include 3D buildings)
363+ const styleLayers = map . getStyle ( ) ?. layers || [ ] ;
364+ const nativeExtrusions = styleLayers . filter ( l => l . type === 'fill-extrusion' && l . id !== 'matrix-buildings-3d' ) ;
365+ if ( nativeExtrusions . length ) {
366+ const vis = shouldShow ? 'visible' : 'none' ;
367+ nativeExtrusions . forEach ( l => map . setLayoutProperty ( l . id , 'visibility' , vis ) ) ;
368+ } else if ( shouldShow && ! map . getLayer ( 'matrix-buildings-3d' ) ) {
369+ // Style lacks native 3D buildings — add custom layer (e.g. dark mode)
370+ const firstSymbol = styleLayers . find ( l => l . type === 'symbol' ) ;
364371 map . addLayer ( {
365372 id : 'matrix-buildings-3d' ,
366373 type : 'fill-extrusion' ,
0 commit comments