mapgl-label-bug2
by Trufi
HTML
<div id="container"></div>
<script src="https://mapgl.2gis.com/api/js/v1"></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: [46.674512, 24.710183],
zoom: 13,
key: 'bfd8bbca-8abf-11ea-b033-5fa57aae2de7',
});
const erriyadhLabel = new mapgl.Label(map, {
coordinates: [46.674512, 24.710183],
text: 'Эр-Рияд',
fontSize: 20,
zIndex: 2,
relativeAnchor:[0.5,1],
image: {
url: 'https://docs.2gis.com/img/mapgl/tooltip.svg',
size: [100, 50],
stretchX: [
[10, 30],
[70, 90],
],
stretchY: [
[10, 30]
],
padding: [10, 10, 20, 10],
},
});