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

Method _setControlsVisibility

src/mapml-viewer.js:588–637  ·  view source on GitHub ↗
(control, hide)

Source from the content-addressed store, hash-verified

586 // Sets the control's visibility AND all its childrens visibility,
587 // for the control element based on the Boolean hide parameter
588 _setControlsVisibility(control, hide) {
589 let container;
590 switch (control) {
591 case 'zoom':
592 if (this._zoomControl) {
593 container = this._zoomControl._container;
594 }
595 break;
596 case 'reload':
597 if (this._reloadButton) {
598 container = this._reloadButton._container;
599 }
600 break;
601 case 'fullscreen':
602 if (this._fullScreenControl) {
603 container = this._fullScreenControl._container;
604 }
605 break;
606 case 'layercontrol':
607 if (this._layerControl) {
608 container = this._layerControl._container;
609 }
610 break;
611 case 'geolocation':
612 if (this._geolocationButton) {
613 container = this._geolocationButton._container;
614 }
615 break;
616 case 'scale':
617 if (this._scaleBar) {
618 container = this._scaleBar._container;
619 }
620 break;
621 }
622 if (container) {
623 if (hide) {
624 // setting the visibility for all the children of the element
625 [...container.children].forEach((childEl) => {
626 childEl.setAttribute('hidden', '');
627 });
628 container.setAttribute('hidden', '');
629 } else {
630 // setting the visibility for all the children of the element
631 [...container.children].forEach((childEl) => {
632 childEl.removeAttribute('hidden');
633 });
634 container.removeAttribute('hidden');
635 }
636 }
637 }
638 _toggleStatic() {
639 const isStatic = this.hasAttribute('static');
640 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