MCPcopy Create free account
hub / github.com/Maps4HTML/MapML.js / _showControls

Method _showControls

src/mapml-viewer.js:536–575  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

534 this._setControlsVisibility('scale', true);
535 }
536 _showControls() {
537 this._setControlsVisibility('fullscreen', false);
538 this._setControlsVisibility('layercontrol', false);
539 this._setControlsVisibility('reload', false);
540 this._setControlsVisibility('zoom', false);
541 this._setControlsVisibility('geolocation', true);
542 this._setControlsVisibility('scale', false);
543
544 // prune the controls shown if necessary
545 // this logic could be embedded in _showControls
546 // but would require being able to iterate the domain of supported tokens
547 // for the controlslist
548 if (this._controlsList) {
549 this._controlsList.forEach((value) => {
550 switch (value.toLowerCase()) {
551 case 'nofullscreen':
552 this._setControlsVisibility('fullscreen', true);
553 break;
554 case 'nolayer':
555 this._setControlsVisibility('layercontrol', true);
556 break;
557 case 'noreload':
558 this._setControlsVisibility('reload', true);
559 break;
560 case 'nozoom':
561 this._setControlsVisibility('zoom', true);
562 break;
563 case 'geolocation':
564 this._setControlsVisibility('geolocation', false);
565 break;
566 case 'noscale':
567 this._setControlsVisibility('scale', true);
568 break;
569 }
570 });
571 }
572 if (this._layerControl && this._layerControl._layers.length === 0) {
573 this._layerControl._container.setAttribute('hidden', '');
574 }
575 }
576
577 // delete the map controls that are private properties of this custom element
578 _deleteControls() {

Callers 2

_toggleControlsMethod · 0.95

Calls 3

forEachMethod · 0.80
setAttributeMethod · 0.80

Tested by

no test coverage detected