@eox/layercontrol 0.6.0 → 0.6.2
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 +76 -5
- package/dist/eox-layercontrol.js +286 -279
- package/dist/eox-layercontrol.umd.cjs +53 -53
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,19 +9,90 @@ npm install @eox/layercontrol
|
|
|
9
9
|
```
|
|
10
10
|
import "@eox/layercontrol"
|
|
11
11
|
|
|
12
|
-
<eox-layercontrol></eox-layercontrol>
|
|
12
|
+
<eox-layercontrol for="eox-map"></eox-layercontrol>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
## Attributes
|
|
16
|
+
|
|
17
|
+
### `for: string = "eox-map"`
|
|
18
|
+
|
|
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
|
+
```
|
|
37
|
+
|
|
38
|
+
### `layerIdentifier: string = "id"`
|
|
39
|
+
|
|
40
|
+
The layer identifier property of the layers. Fallback is set automatically based on `ol_uid` if not provided.
|
|
41
|
+
|
|
42
|
+
### `layerTitle: string = "title"`
|
|
43
|
+
|
|
44
|
+
The layer title property of the layers. "title" by default, fallback is set automatically based on "layer" + `ol_uid` if not provided.
|
|
45
|
+
|
|
46
|
+
### `layerConfig: Array<string> = ["opacity"]`
|
|
47
|
+
|
|
48
|
+
// TODO
|
|
49
|
+
|
|
50
|
+
### `externalLayerConfig: Boolean = undefined`
|
|
51
|
+
|
|
52
|
+
// TODO
|
|
53
|
+
|
|
54
|
+
### `unstyled: Boolean`
|
|
55
|
+
|
|
56
|
+
Display the unstyled version of the layer control.
|
|
57
|
+
|
|
58
|
+
## Layer properties
|
|
59
|
+
|
|
60
|
+
In order to be displayed correctly, the OpenLayers map layers need some custom properties (using e.g. `layer.set(property, value)`).
|
|
61
|
+
|
|
62
|
+
### `id?: string`
|
|
63
|
+
|
|
64
|
+
The layer id. Not required but recommended (see [automatic fallback](#layeridentifier-string--id)).
|
|
65
|
+
|
|
66
|
+
### `title?: string`
|
|
67
|
+
|
|
68
|
+
The title of the layer displayed in the layer control. Not required (see [automatic fallback](#layertitle-string--title)), but recommended in order to display human-readable layer titles.
|
|
69
|
+
|
|
70
|
+
### `layerControlHide?: Boolean`
|
|
71
|
+
|
|
72
|
+
Completely hide a layer from the layer control.
|
|
73
|
+
|
|
74
|
+
### `layerControlOptional?: Boolean`
|
|
75
|
+
|
|
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.
|
|
77
|
+
|
|
78
|
+
### `layerControlExclusive?: Boolean`
|
|
79
|
+
|
|
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.
|
|
16
81
|
|
|
17
82
|
## Contribute
|
|
18
83
|
|
|
84
|
+
### Setup
|
|
85
|
+
|
|
19
86
|
```
|
|
20
|
-
npm
|
|
21
|
-
|
|
22
|
-
|
|
87
|
+
npm install
|
|
88
|
+
npm start
|
|
89
|
+
npm run format
|
|
23
90
|
|
|
24
91
|
npm version <new version>
|
|
25
92
|
npm run build
|
|
26
93
|
npm publish (requires OTP)
|
|
27
94
|
```
|
|
95
|
+
|
|
96
|
+
### Testing
|
|
97
|
+
|
|
98
|
+
// TODO
|