Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/api/mapml-viewer-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The HTMLMapmlViewerElement interface represents the `<mapml-viewer>` element.
| Property name | Description |
|-------------- |-------------------------------------------------------- |
| [controls](#controls) | Turns native map controls on or off. Reflects the controls attribute. |
| [controlslist](#controlslist) | Allows to change the set of native controls. Reflects the controlslist attribute. |
| [controlsList](#controlslist) | Allows to change the set of native controls. Reflects the controlslist attribute. |
| [extent](#extent) | Returns the extent of the current map view. Read only. |
| [lat](#lat) | Get the map's latitude. Reflects the lat attribute. Read only. |
| [lon](#lon) | Get the map's longitude. Reflects the lon attribute. Read only. |
Expand All @@ -37,18 +37,24 @@ let controlsAdded = map.controls;

---

### controlslist
### controlsList

The `controlsList` property returns a [DomTokenList](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList)
that helps the user select what controls to display on the `mapml-viewer` element based on the [possible values](../elements/mapml-viewer/#controlslist).

To set the controlslist attribute:
```js
let map = document.querySelector('mapml-viewer');
map.controlslist = "noreload"; // values can be noreload | nofullscreen | nozoom | nolayer
map.controlsList.value = "noreload nozoom"; // values can be noreload | nofullscreen | nozoom | nolayer

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that it also works to do map.controlsList = "noreload nozoom", I believe

map.controlsList.add("nofullscreen"); // can also add using the 'add' method
map.controlsList.toggle("nolayer"); // can also toggle using the 'toggle' method
// view all methods here - https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList
```

To get the value of the controlslist:
```js
let map = document.querySelector('mapml-viewer');
let controlsList = map.controlslist;
let controlsList = map.controlsList.value;
```

---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ L’interface HTMLMapmlViewerElement représente l’élément `<mapml-viewer>`.
| Nom de la propriété | Description |
|-------------- |-------------------------------------------------------- |
| [controls](#controls) | Active ou désactive les contrôles natifs de la carte. Reproduit l’attribut controls. |
| [controlslist](#controlslist) | Permet de changer l’ensemble des contrôles natifs. Reproduit l’attribut controlslist. |
| [controlsList](#controlslist) | Permet de changer l’ensemble des contrôles natifs. Reproduit l’attribut controlslist. |
| [extent](#extent) | Retourne l’étendue de la carte affichée. En lecture seule. |
| [lat](#lat) | Permet d’obtenir la latitude de la carte. Reproduit l’attribut lat. En lecture seule. |
| [lon](#lon) | Permet d’obtenir la longitude de la carte. Reproduit l’attribut lon. En lecture seule. |
Expand All @@ -37,18 +37,24 @@ let controlsAdded = map.controls;

---

### controlslist
### controlsList

La propriété `controlsList` renvoie une [DomTokenList](https://developer.mozilla.org/fr/docs/Web/API/DOMTokenList)
qui aide l'utilisateur à sélectionner les contrôles à afficher sur l'élément `mapml-viewer` en fonction des [valeurs possibles](../elements/mapml-viewer/#controlslist).

Pour définir l’attribut controlslist :
```js
let map = document.querySelector('mapml-viewer');
map.controlslist = "noreload"; // les valeurs peuvent être noreload | nofullscreen | nozoom | nolayer
map.controlsList.value = "noreload nozoom"; // les valeurs peuvent être noreload | nofullscreen | nozoom | nolayer
map.controlsList.add("nofullscreen"); // peut également être ajouté à l'aide de la méthode 'add'
map.controlsList.toggle("nolayer"); // peut également être basculé à l'aide de la méthode 'toggle.
// Voir toutes les méthodes ici - https://developer.mozilla.org/fr/docs/Web/API/DOMTokenList
```

Pour obtenir la valeur de controlslist :
```js
let map = document.querySelector('mapml-viewer');
let controlsList = map.controlslist;
let controlsList = map.controlsList.value;
```

---
Expand Down