wip
This commit is contained in:
38
resources/js/services/yandex.js
vendored
Normal file
38
resources/js/services/yandex.js
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import {isDefined, logError} from '../utils/helper';
|
||||
|
||||
export default {
|
||||
NAME: 'yandex',
|
||||
createMap(element, mapData) {
|
||||
if (!isDefined(window.ymaps)) {
|
||||
logError('ymaps is undefined');
|
||||
return;
|
||||
}
|
||||
const {lat, lng, zoom} = mapData;
|
||||
|
||||
const map = new window.ymaps.Map(element, {
|
||||
center: [lat, lng],
|
||||
zoom,
|
||||
});
|
||||
|
||||
// window.google.maps.event.addListenerOnce(map, 'idle', () => {
|
||||
// fadeElementIn(element);
|
||||
// });
|
||||
|
||||
return map;
|
||||
},
|
||||
createMarker(map, markerData) {
|
||||
const {title, lat, lng, url} = markerData;
|
||||
|
||||
const marker = new window.ymaps.Placemark([lat, lng], {
|
||||
hintContent: title,
|
||||
});
|
||||
|
||||
// if (url) {
|
||||
// marker.addListener('click', () => {
|
||||
// openUrl(url);
|
||||
// });
|
||||
// }
|
||||
|
||||
map.geoObjects.add(marker);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user