# j-MapZones

> The component for drawing and displaying zones on the map. This component uses [OpenLayers](https://openlayers.org/) library with the [OpenStreetMap](https://www.openstreetmap.org/) map engine. The co

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 287457598ac3fb791d14d216c667a776df7a5030b56e856266727d89c74213d1
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

The component for drawing and displaying zones on the map. This component uses [OpenLayers](https://openlayers.org/) library with the [OpenStreetMap](https://www.openstreetmap.org/) map engine. The component uses 3rd party dependencies.

__Configuration__:

- `height {Number/String}` fixed height or a parent element (default: `200`)
- `color {String}` enables custom color for created polygon (default: `#fcba03`)
- `zoom {Number}` a default zoom level (default: `11`)
- `modify {Boolean}` enables modifiyng of the polygon (default: `true`)
- `opacity {Number}` determines the transparency of the polygon in percentage (default: `20`)
- __NEW__ `exec {String}` a link to the `function(value)`, it's executed when the value is changed

__Data-source__ needs to contain:

```js
{
    points: [{ lat: 48.75152530164132, lng: 19.13902142954625 }, { lat: 48.726826662905296, lng: 19.123238694044034 }, ...] // polygon points
    color: '#FD391A', // optional
    zoom: 13 // optional
}
```

__Good to know__:

- `SHIFT + click` on vertices (created point) will delete selected point

Use it with `<ui-component name="mapzones">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Dodo Marton / Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<div style="width:400px">
	<ui-component name="mapzones" path="map" config="height:400;color:#FD391A"></ui-component>
</div>

<script>
	var map = { 
		points: [
			{ lat: 48.75152530164132, lng: 19.13902142954625 },
			{ lat: 48.726826662905296, lng: 19.123238694044034 },
			{ lat: 48.739833820262106, lng: 19.190119425971947 },
			{ lat: 48.75152530164132, lng: 19.13902142954625 }
		],
		color: '#FD391A',
		zoom: 13 
	};
</script>
```
