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

Method _setControlsVisibility

src/web-map.js:630–679  ·  view source on GitHub ↗
(control, hide)

Source from the content-addressed store, hash-verified

628 // Sets the control's visibility AND all its childrens visibility,
629 // for the control element based on the Boolean hide parameter
630 _setControlsVisibility(control, hide) {
631 let container;
632 switch (control) {
633 case 'zoom':
634 if (this._zoomControl) {
635 container = this._zoomControl._container;
636 }
637 break;
638 case 'reload':
639 if (this._reloadButton) {
640 container = this._reloadButton._container;
641 }
642 break;
643 case 'fullscreen':
644 if (this._fullScreenControl) {
645 container = this._fullScreenControl._container;
646 }
647 break;
648 case 'layercontrol':
649 if (this._layerControl) {
650 container = this._layerControl._container;
651 }
652 break;
653 case 'geolocation':
654 if (this._geolocationButton) {
655 container = this._geolocationButton._container;
656 }
657 break;
658 case 'scale':
659 if (this._scaleBar) {
660 container = this._scaleBar._container;
661 }
662 break;
663 }
664 if (container) {
665 if (hide) {
666 // setting the visibility for all the children of the element
667 [...container.children].forEach((childEl) => {
668 childEl.setAttribute('hidden', '');
669 });
670 container.setAttribute('hidden', '');
671 } else {
672 // setting the visibility for all the children of the element
673 [...container.children].forEach((childEl) => {
674 childEl.removeAttribute('hidden');
675 });
676 container.removeAttribute('hidden');
677 }
678 }
679 }
680 _toggleStatic() {
681 const isStatic = this.hasAttribute('static');
682 if (this._map) {

Callers 2

_hideControlsMethod · 0.95
_showControlsMethod · 0.95

Calls 2

forEachMethod · 0.80
setAttributeMethod · 0.80

Tested by

no test coverage detected