@eox/layercontrol 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -9
- package/dist/eox-layercontrol.js +199 -136
- package/dist/eox-layercontrol.umd.cjs +70 -9
- package/package.json +1 -1
- package/test/_mockMap.ts +49 -0
- package/test/general.cy.ts +87 -0
- package/test/changingLayers.cy.ts +0 -44
- package/test/geotiff.cy.ts +0 -72
- package/test/mapIntegration.cy.ts +0 -35
- package/test/mapIntegration.html +0 -47
- package/test/mapIntegration.json +0 -65
- package/test/zIndex.cy.ts +0 -34
package/README.md
CHANGED
|
@@ -14,9 +14,26 @@ import "@eox/layercontrol"
|
|
|
14
14
|
|
|
15
15
|
## Attributes
|
|
16
16
|
|
|
17
|
-
### `for: string = "eox-map"`
|
|
17
|
+
### `for: string = "eox-map"`
|
|
18
18
|
|
|
19
|
-
The query selector of the `eox-map` you wish to
|
|
19
|
+
The query selector of the `eox-map` you wish to attach the layer control to.
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
<eox-map layers="[...]"></eox-map>
|
|
23
|
+
<eox-layercontrol for="eox-map"></eox-layercontrol>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
When used with a vanilla OpenLayer map, you need to reference the JS map object in the DOM, such as:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
const olMap = new Map({
|
|
30
|
+
...
|
|
31
|
+
target: "map-div"
|
|
32
|
+
})
|
|
33
|
+
document.querySelector("map-div").map = olMap
|
|
34
|
+
|
|
35
|
+
<eox-layercontrol for="#map-div"></eox-layercontrol>
|
|
36
|
+
```
|
|
20
37
|
|
|
21
38
|
### `layerIdentifier: string = "id"`
|
|
22
39
|
|
|
@@ -38,13 +55,8 @@ The layer title property of the layers. "title" by default, fallback is set auto
|
|
|
38
55
|
|
|
39
56
|
Display the unstyled version of the layer control.
|
|
40
57
|
|
|
41
|
-
## Methods
|
|
42
|
-
|
|
43
|
-
### `attachTo(mapObject: Map)` (when used with a vanilla OpenLayer map)
|
|
44
|
-
|
|
45
|
-
Attach the layer control to an OpenLayer map instance. When used with an `eox-map`, see the [`for` attribute](#for-when-used-with-eox-map) instead.
|
|
46
|
-
|
|
47
58
|
## Layer properties
|
|
59
|
+
|
|
48
60
|
In order to be displayed correctly, the OpenLayers map layers need some custom properties (using e.g. `layer.set(property, value)`).
|
|
49
61
|
|
|
50
62
|
### `id?: string`
|
|
@@ -58,6 +70,7 @@ The title of the layer displayed in the layer control. Not required (see [automa
|
|
|
58
70
|
### `layerControlHide?: Boolean`
|
|
59
71
|
|
|
60
72
|
Completely hide a layer from the layer control.
|
|
73
|
+
|
|
61
74
|
### `layerControlOptional?: Boolean`
|
|
62
75
|
|
|
63
76
|
Initially hide a layer from the layer control, but make it available as an optional layer. If the layer is selected and added, it will be set to visible and pushed to the top of the layer list or (if originally configured within a layer group) to the top of the layer group.
|
|
@@ -66,7 +79,6 @@ Initially hide a layer from the layer control, but make it available as an optio
|
|
|
66
79
|
|
|
67
80
|
Make layers mutually exclusive. If two or more layers (on the same level, i.e. at root or inside a layer group) have this property, then only one of them can be visualized at a time.
|
|
68
81
|
|
|
69
|
-
|
|
70
82
|
## Contribute
|
|
71
83
|
|
|
72
84
|
### Setup
|