@@ -230,7 +230,9 @@ export class MapViewer extends HTMLElement {
230230 setControls ( isToggle , toggleShow , setup ) {
231231 if ( this . controls && this . _map ) {
232232 let controls = [ "_zoomControl" , "_reloadButton" , "_fullScreenControl" , "_layerControl" ] ,
233- options = [ "nozoom" , "noreload" , "nofullscreen" , 'nolayer' ] ;
233+ options = [ "nozoom" , "noreload" , "nofullscreen" , 'nolayer' ] ,
234+ mapSize = this . _map . getSize ( ) . y ,
235+ totalSize = 0 ;
234236
235237 //removes the left hand controls, if not done they will be re-added in the incorrect order
236238 //better to just reset them
@@ -255,13 +257,16 @@ export class MapViewer extends HTMLElement {
255257 this . _map . fire ( "validate" ) ;
256258 }
257259 }
258- if ( ! this . controlslist . toLowerCase ( ) . includes ( "nozoom" ) && ! this . _zoomControl ) {
260+ if ( ! this . controlslist . toLowerCase ( ) . includes ( "nozoom" ) && ! this . _zoomControl && ( totalSize + 93 ) <= mapSize ) {
261+ totalSize += 93 ;
259262 this . _zoomControl = L . control . zoom ( ) . addTo ( this . _map ) ;
260263 }
261- if ( ! this . controlslist . toLowerCase ( ) . includes ( "noreload" ) && ! this . _reloadButton ) {
264+ if ( ! this . controlslist . toLowerCase ( ) . includes ( "noreload" ) && ! this . _reloadButton && ( totalSize + 49 ) <= mapSize ) {
265+ totalSize += 49 ;
262266 this . _reloadButton = M . reloadButton ( ) . addTo ( this . _map ) ;
263267 }
264- if ( ! this . controlslist . toLowerCase ( ) . includes ( "nofullscreen" ) && ! this . _fullScreenControl ) {
268+ if ( ! this . controlslist . toLowerCase ( ) . includes ( "nofullscreen" ) && ! this . _fullScreenControl && ( totalSize + 49 ) <= mapSize ) {
269+ totalSize += 49 ;
265270 this . _fullScreenControl = L . control . fullscreen ( ) . addTo ( this . _map ) ;
266271 }
267272 //removes any control layers that are not needed, either by the toggling or by the controlslist attribute
0 commit comments