mapgl direciton zoom width
by Trufi
HTML
<div id="container"></div>
<script src="https://mapgl.2gis.com/api/js/v1"></script>
<script src="https://unpkg.com/@2gis/mapgl-directions@^2/dist/directions.js"></script>
CSS
html,
body,
#container {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
JavaScript
// API key can be used on jsfiddle.net only!
// You can get more info on https://docs.2gis.com/
const map = new mapgl.Map('container', {
center: [55.31878, 25.23584],
zoom: 13,
key: 'bfd8bbca-8abf-11ea-b033-5fa57aae2de7',
});
const directions = new mapgl.Directions(map, {
directionsApiKey: 'rubfpx2151',
});
directions.carRoute({
points: [
[55.28273111108218, 25.234131928828333],
[55.35242563034581, 25.23925607042088]
],
style: {
routeLineWidth: ['interpolate', ['linear'], ['zoom'],
10, 30, // zoom - width
14, 3 // zoom - width
],
substrateLineWidth: 20,
haloLineWidth: 5,
}
});