MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / _showControls

Method _showControls

src/web-map.js:578–617  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

576 this._setControlsVisibility('scale', true);
577 }
578 _showControls() {
579 this._setControlsVisibility('fullscreen', false);
580 this._setControlsVisibility('layercontrol', false);
581 this._setControlsVisibility('reload', false);
582 this._setControlsVisibility('zoom', false);
583 this._setControlsVisibility('geolocation', true);
584 this._setControlsVisibility('scale', false);
585
586 // prune the controls shown if necessary
587 // this logic could be embedded in _showControls
588 // but would require being able to iterate the domain of supported tokens
589 // for the controlslist
590 if (this._controlsList) {
591 this._controlsList.forEach((value) => {
592 switch (value.toLowerCase()) {
593 case 'nofullscreen':
594 this._setControlsVisibility('fullscreen', true);
595 break;
596 case 'nolayer':
597 this._setControlsVisibility('layercontrol', true);
598 break;
599 case 'noreload':
600 this._setControlsVisibility('reload', true);
601 break;
602 case 'nozoom':
603 this._setControlsVisibility('zoom', true);
604 break;
605 case 'geolocation':
606 this._setControlsVisibility('geolocation', false);
607 break;
608 case 'noscale':
609 this._setControlsVisibility('scale', true);
610 break;
611 }
612 });
613 }
614 if (this._layerControl && this._layerControl._layers.length === 0) {
615 this._layerControl._container.setAttribute('hidden', '');
616 }
617 }
618
619 // delete the map controls that are private properties of this custom element
620 _deleteControls() {

Callers 2

_toggleControlsMethod · 0.95

Calls 3

forEachMethod · 0.80
setAttributeMethod · 0.80

Tested by

no test coverage detected