Добавление маркеров на карту
Совет
Чтобы поведение обычных маркеров соответствовало Yandex Maps 2, задайте:
positionX
наleft-center
positionY
наtop
.
position
будет сформирован как left-center top
.
html
<yandex-map
:height="height"
:settings="{
location: {
center,
zoom,
},
theme,
showScaleInCopyrights: true,
}"
:width="width"
>
<yandex-map-default-scheme-layer/>
<yandex-map-default-features-layer/>
<yandex-map-controls :settings="{ position: 'right' }">
<yandex-map-zoom-control/>
</yandex-map-controls>
<yandex-map-controls :settings="{ position: 'top left' }">
<yandex-map-control-button>
<label>
Position (X)
<select v-model="positionX">
<option
v-for="(key, value) in positionsX"
:key="key"
:value="value"
>
{{ key }}
</option>
</select>
</label>
</yandex-map-control-button>
<yandex-map-control-button>
<label>
Position (Y)
<select v-model="positionY">
<option
v-for="(key, value) in positionsY"
:key="key"
:value="value"
>
{{ key }}
</option>
</select>
</label>
</yandex-map-control-button>
</yandex-map-controls>
<template
v-for="(point, index) in POINTS"
:key="index"
>
<yandex-map-marker
v-if="'element' in point"
:position="`${ positionX } ${ positionY }` as any"
:settings="point"
:style="{
'--color': 'color' in point && point.color,
'--image': 'colors' in point && diagramBackground(point.colors),
}"
>
<template v-if="point.element === 'diagram'">
<div
v-if="'title' in point"
class="pie-marker-title"
>
{{ point.title }}
</div>
<div
class="pie-marker"
/>
</template>
<div
v-else-if="point.element === 'circle'"
class="circle"
:style="{
'--radius': 'radius' in point ? point.radius : '20px',
'--color': 'color' in point ? point.color : undefined,
'--icon': 'icon' in point ? point.icon : '#fff',
'--image': 'icon' in point ? point.icon : undefined,
}"
:title="'title' in point && point.title"
>
<div class="circle_element"/>
</div>
<div
v-else-if="point.element === 'icon'"
class="icon"
:style="{
'--size': 'size' in point ? point.size : '20px',
'--color': 'color' in point ? point.color : undefined,
'--icon': 'icon' in point ? `url(${ point.icon })` : undefined,
}"
>
<div
v-if="'title' in point"
class="icon_title"
v-html="point.title"
/>
</div>
</yandex-map-marker>
<yandex-map-default-marker
v-else
:settings="point"
/>
</template>
<yandex-map-default-marker :settings="{ coordinates: INC_POINT.coordinates, title: markerTitle }"/>
</yandex-map>
ts
import {
YandexMap,
YandexMapControlButton,
YandexMapControls,
YandexMapDefaultFeaturesLayer,
YandexMapDefaultMarker,
YandexMapDefaultSchemeLayer,
YandexMapMarker,
YandexMapZoomControl,
} from 'vue-yandex-maps';
import { onMounted, onUnmounted, ref } from 'vue';
import type { LngLat } from '@yandex/ymaps3-types';
type PartialRecord<K extends keyof any, T> = {
[P in K]?: T;
};
const INC_POINT = {
coordinates: [37.95, 55.9] as LngLat,
title: 'Marker inc #0',
};
const markerTitle = ref('');
const positionsX = {
left: 'left',
right: 'right',
'right-center': 'right-center',
'left-center': 'left-center',
custom: '-25%',
default: 'default',
} satisfies PartialRecord<YandexMapMarkerPosition | 'custom', string>;
const positionsY = {
top: 'top',
bottom: 'bottom',
'top-center': 'top-center',
'bottom-center': 'bottom-center',
custom: '-25%',
default: 'default',
} satisfies PartialRecord<YandexMapMarkerPosition | 'custom', string>;
const positionX = ref<keyof typeof positionsX>('default');
const positionY = ref<keyof typeof positionsY>('default');
onMounted(() => {
let inc = 0;
const updateTitle = () => {
inc++;
markerTitle.value = `Marker inc #${ inc }`;
};
updateTitle();
const timer = setInterval(updateTitle, 1000);
onUnmounted(() => {
clearInterval(timer);
});
});
const diagramBackground = (colors: { percentage: number; color: string }[]): string => {
const gradient = [];
let previous = 0;
for (let i = 0; i < colors.length; i += 1) {
const p = colors[i];
const deg = (360 / 100) * p.percentage;
gradient.push(`${ p.color } ${ previous }deg ${ previous + deg }deg`);
previous += deg;
}
return `conic-gradient(${ gradient.join(', ') })`;
};
const POINTS: any[] = [
{ coordinates: [37.8, 55.8] },
{
coordinates: [37.6, 55.847],
title: 'Diagram',
color: '#0E4779',
draggable: true,
colors: [
{
percentage: 30,
color: '#0E4779',
},
{
percentage: 20,
color: '#1E98FF',
},
{
percentage: 40,
color: '#82CDFF',
},
{
percentage: 10,
color: '#ff9f82',
},
],
element: 'diagram',
},
{
coordinates: [37.738521, 55.684758],
color: '#0095b6',
title: 'color <strong>bondi beach water<strong>',
draggable: true,
},
{
coordinates: [37.715175, 55.833436],
color: '#735184',
title: '<strong>Silver crimson<strong> color',
draggable: true,
},
{
coordinates: [37.529789, 55.687086],
color: '#3caa3c',
title: 'love toad color',
draggable: true,
element: 'circle',
},
{
coordinates: [37.95, 55.782392],
color: 'yellow',
title: 'color <strong>sun<strong>',
draggable: true,
onClick: () => alert('click'),
},
{
coordinates: [37.656123, 55.642063],
title: 'color <strong>red<strong>',
size: '60px',
icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAAB8CAYAAACbksWfAAAAAXNSR0IArs4c6QAAGnlJREFUeF7tXQd4lMXWPrMlm+xms0kMEgKXIIQuVxREvd4fI3JBQBFUihSxgA0QkF5UbMC10ISAFJFQhIAiGKXpFYUrIEoRDCCGEilJCCm7yZbsfjv/c5Zd/mR3vrYd+c/z5OHRnW++mXm/mXPmVAJRRJTShgBQBwAMABDv/tMBQBUAVLr/KgDgMiGkIIqGHvShkKD3KKFDSqkWANq5/9oAQAMAuEnCo95NSgDgTwA4CgA/A8AhQojFj36i7pGwAUMpjQWA7gDwEAD8PYQrcRgAcgkhX4TwHSHvOuTAUEqbAkB/AOgCAHEhn9H/vQCPv60AsI4QcjaM7w3Kq0ICDKVUBQCdAKAfANwWlJEG1slPALAeAHYTQpyBdRWep4MODKX0QQAY4yfPCPWsLwHALELIf0P9okD7DxowlNIkAHgVADr6OyhqsSgcp/Nj6eUStdNYoaImo5KaLUqi03EKfYKDJOg5kpJiVzVuYiVxcYF8+VsA4H1CiNnfsYb6uaAAQym93w1KgtQBO8vKVPZDB+MdeXk67veTOuelS7HOigq11OcViYl2kpZmVTdrVqlq1bpKffsdlcRg4KQ+DwAo0U0jhKA0F3UUEDCU0hgAGAcAj0qamd1ObNu3J9l2bEtxnDypB0olPSapESGgat3aqHnwwRJNp87loFJJ6Rx33UoAWEwIkQOqpCEF0shvYCilGQDwbwBIFxsAN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p159ixY9fOnu26DgnxFSzGg2Jw1O+SSO6YLADAiOdaZJr+2i32H2t7W+peGn5W06s3rzPD1q1bv+7evTsGtfLxFVRc4rGFF8brjsK2Y9wJg1AN46POL3us923UZLpWD02gSqtrgYuKin5OTU1FoxeffQWLIPx03aFRY8DhBAYjmz/0Xixvb0vlLbdUuSKJ1Woms7fZbBfS0tJ2l5aWYlVbb76CktaOUFkVwwl0OIFhJkG1rMqua1mV7fK2dGmMF2Sd4Em0g5dIc2Zm5uY9e/ZgOpSafAWNZCjtBSc/VjgR4HlXOIHBmHmMJqtFxvHjMhxHDru8LYWivRCIyZMnr5s1axbGd9bkK8jcsV40U3KLgjX2awjhBIbJ+D32F/WdHcr07zCLs7km9v333+/IzMz06MCQt6CnI9rxWRXD/VqMaHoonMC8BQDdWJOnRUVqvqAiN7M/kpqaigDgTkFw8E5yXTN3sY8gnMBgBdAxYgPy/t1msxU3bNhwb3FxMTJ7dAJHyY6Z+0Vu39HcPpzAYA2a7QCACyyJnE4n9OvXL3fjxo2oSkFAhEvvSer1+mgUNmBwOSilmGQbb/+SaM2aNTsGDRqE+Z/RzHtDUViBcYODdxmxbE2X9+/f/87dd9+NN/cbksIOjBucx9w7h2VGxgqDc0NRKe96QjgiwHgWyB172R4A8IKIoRGHCCGyQuKup8WWM9aIAiNnoDda2/8HJkoR/18+VzNdh1ga8wAAAABJRU5ErkJggg==',
draggable: true,
element: 'icon',
onDoubleClick: () => alert('Double click'),
},
{
coordinates: [37.487208, 55.826479],
title: 'the color of <strong>Pacific Ocean<strong>',
color: '#3b5998',
draggable: true,
mapFollowsOnDrag: true,
},
{
coordinates: [37.435023, 55.694843],
color: '#477510',
title: 'nose color Donatello',
subtitle: 'Very long but incredibly interesting text',
draggable: true,
},
{
coordinates: [37.535023, 55.6],
color: '#343d44',
title: 'Hello!',
subtitle: 'Very long but <br>incredibly interesting text',
draggable: true,
},
{
coordinates: [37.814052, 55.790139],
title: 'blue color',
icon: 'url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMiIgaGVpZ2h0PSIyMiI+PHBhdGggZmlsbD0iIzgwODI4NSIgZD0iTTEyLjc0IDUuNzlWMy40N2wtNS44IDEuMTZINS4yMnYxMy45aDEuNzR2LTYuOTVsMy40Ny0uNTh2Mi4zMmw3LjUzLS41OHYtNy42bC01LjIxLjY1eiIvPjwvc3ZnPg==)',
color: '#51aabd',
radius: '50px',
draggable: true,
element: 'circle',
onFastClick: () => alert('Fast click'),
},
];
css
<style scoped>
select {
border: 1px solid #000;
padding-left: 5px;
}
.pie-marker-title {
position: absolute;
top: 120%;
left: 50%;
padding: 2px 4px;
background-color: #fff;
transform: translateX(-50%);
color: var(--color);
}
.pie-marker {
background-color: currentColor;
background-image: var(--image);
width: 50px;
height: 50px;
border-radius: 50%;
overflow: hidden;
}
.circle {
width: var(--radius);
height: var(--radius);
border-radius: 50%;
background-color: currentColor;
color: var(--color);
}
.circle_element {
position: absolute;
top: 50%;
left: 50%;
display: inline-block;
width: 50%;
height: 50%;
border-radius: 50%;
background: #fff var(--image) no-repeat center center;
transform: translate3d(-50%, -50%, 0);
}
.icon {
position: relative;
width: var(--size);
height: var(--size);
color: var(--color);
background: var(--icon) no-repeat center center / contain;
}
.icon_title {
position: absolute;
top: 120%;
left: 50%;
padding: 2px 4px;
background-color: #fff;
transform: translateX(-50%);
}
</style>