Answer the question
In order to leave comments, you need to log in
Yandex map not scalable?
Dynamically create a map:
ymaps.ready(init);
var myMap,
myPlacemark;
function init() {
myMap = new ymaps.Map("map", {
center: [{{ $event->lat }}, {{ $event->long }}],
zoom: 10
});
ymaps.geocode('Россия, {{ $city }}, {{ $event->address }}', {
results: 1
}).then(function (res) {
var firstGeoObject = res.geoObjects.get(0),
coords = firstGeoObject.geometry.getCoordinates(),
bounds = firstGeoObject.properties.get('boundedBy');
myMap.geoObjects.add(firstGeoObject);
myMap.setBounds(bounds, {
checkZoomRange: true
});
});
}
Answer the question
In order to leave comments, you need to log in
Try to get the coordinates of the required area using the getBounds function of the
Yandex Maps
API.
It should look something like this:
//после добавления объекта
var bounds = myMap.geoObjects.getBounds();
myMap.setBounds(bounds, {
checkZoomRange: true
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question