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(); 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> </script>
<div> <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> </div>
<script> <script>
document.getElementById('visibilityLayer').onclick = () => { document.getElementById('show/hideLayer').onclick = () => {
if (document.getElementById('visibilityLayer').checked) { if (document.getElementById('show/hideLayer').checked) {
WA.showLayer('Metadata'); WA.showLayer('LayerName');
} }
else { else {
WA.hideLayer('Metadata'); WA.hideLayer('LayerName');
} }
} }
</script> </script>