documentation of show/hide layer

This commit is contained in:
GRL 2021-05-10 15:10:11 +02:00
parent fd931c4884
commit 973b3405ef
2 changed files with 34 additions and 5 deletions

View file

@ -235,3 +235,32 @@ mySound.play(config);
// ...
mySound.stop();
```
### Show / Hide a layer
```
WA.showLayer(layerName : string): void
WA.hideLayer(layerName : string) : void
```
These 2 methods can be used to show and hide a layer.
Example :
```javascript
<div>
<label for="show/hideBottom">See bottom : </label>
<input type="checkbox" id="show/hideBottom" name="visible" value="show" checked>
</div>
<script>
document.getElementById('show/hideLayer').onclick = () => {
if (document.getElementById('show/hideBottom').checked) {
WA.showLayer('bottom');
}
else {
WA.hideLayer('bottom');
}
}
</script>
```

View file

@ -19,15 +19,15 @@
}));
</script>
<div>
<label for="visibilityLayer">Metadata Layer</label><input type="checkbox" id="visibilityLayer" name="visible" value="show" checked>
<label for="show/hideLayer">Layer Name : </label><input type="checkbox" id="show/hideLayer" name="visible" value="show" checked>
</div>
<script>
document.getElementById('visibilityLayer').onclick = () => {
if (document.getElementById('visibilityLayer').checked) {
WA.showLayer('Metadata');
document.getElementById('show/hideLayer').onclick = () => {
if (document.getElementById('show/hideLayer').checked) {
WA.showLayer('LayerName');
}
else {
WA.hideLayer('Metadata');
WA.hideLayer('LayerName');
}
}
</script>