0.17.3 • Published 30 days ago

@eox/layercontrol v0.17.3

Weekly downloads
-
License
-
Repository
-
Last release
30 days ago

Layer control

Usage

npm install @eox/layercontrol
import "@eox/layercontrol"

<eox-layercontrol for="eox-map"></eox-layercontrol>

Attributes

for: string = "eox-map"

The query selector of the eox-map you wish to attach the layer control to.

<eox-map .layers="[...]"></eox-map>
<eox-layercontrol for="eox-map"></eox-layercontrol>

When used with a vanilla OpenLayer map, you need to reference the JS map object in the DOM, such as:

const olMap = new Map({
    ...
    target: "map-div"
})
document.querySelector("map-div").map = olMap

<eox-layercontrol for="#map-div"></eox-layercontrol>

idProperty: string = "id"

The layer identifier property of the layers. Fallback is set automatically based on ol_uid if not provided.

titleProperty: string = "title"

The layer title property of the layers. "title" by default, fallback is set automatically based on "layer" + ol_uid if not provided.

unstyled: Boolean

Display the unstyled version of the layer control.

Layer properties

In order to be displayed correctly, the OpenLayers map layers need some custom properties (using e.g. layer.set(property, value)).

id?: string

The layer id. Not required but recommended (see automatic fallback).

title?: string

The title of the layer displayed in the layer control. Not required (see automatic fallback), but recommended in order to display human-readable layer titles.

layerControlHide?: Boolean

Completely hide a layer from the layer control.

layerControlOptional?: Boolean

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.

layerControlExclusive?: Boolean

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.

layerControlExpand?: Boolean

Pre-expand a layer dropdown so that it is always open when the component initializes.

Contribute

Setup

npm install
npm start
npm run format

npm version <new version>
npm run build
npm publish (requires OTP)

Testing

This element includes components tests and is part of e2e tests. Please refer to the root README for more details.

Changelog

Created automatically here

0.17.3

30 days ago

0.17.2

2 months ago

0.17.1

2 months ago

0.17.0

3 months ago

0.16.0

3 months ago

0.15.1

3 months ago

0.15.0

3 months ago

0.14.0

4 months ago

0.13.1

5 months ago

0.13.0

5 months ago

0.12.0

5 months ago

0.11.4

5 months ago

0.11.3

6 months ago

0.6.7

8 months ago

0.6.6

8 months ago

0.6.9

8 months ago

0.6.8

8 months ago

0.11.0

6 months ago

0.11.1

6 months ago

0.11.2

6 months ago

0.10.0

6 months ago

0.3.0

11 months ago

0.9.0

7 months ago

0.6.3

9 months ago

0.8.0

7 months ago

0.7.1

7 months ago

0.6.2

10 months ago

0.6.5

9 months ago

0.5.0

10 months ago

0.4.0

10 months ago

0.3.1

11 months ago

0.7.0

7 months ago

0.6.1

10 months ago

0.6.0

10 months ago

0.5.1

10 months ago

0.2.0

11 months ago