1
0
Fork 0
forked from 0x2620/oxjs

fix a bug where selecting a not-yet-loaded place on a list map would not pan but zoom to that place

This commit is contained in:
rlx 2011-10-08 09:58:31 +00:00
commit 7eb73dd4fb
3 changed files with 9 additions and 7 deletions

View file

@ -769,7 +769,7 @@ Ox.Map = function(options, self) {
self.$findInput.options({value: self.options.find})
.triggerEvent('submit', {value: self.options.find});
} else if (self.options.selected) {
selectPlace(self.options.selected);
selectPlace(self.options.selected, true);
} else {
mapBounds && self.map.fitBounds(mapBounds);
///*
@ -1058,7 +1058,7 @@ Ox.Map = function(options, self) {
*/
}
function selectPlace(id) {
function selectPlace(id, zoom) {
// id can be null (deselect)
var place,
selected = getSelectedMarker();
@ -1087,7 +1087,11 @@ Ox.Map = function(options, self) {
}, result.data.items[0])).add();
self.places.push(place);
select();
zoomToPlace();
if (zoom) {
zoomToPlace();
} else {
panToPlace();
}
}
});
}