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
parent 02838540db
commit 7eb73dd4fb
3 changed files with 9 additions and 7 deletions

View file

@ -1,5 +1,4 @@
Ox.load('UI', {debug: true}, function() {
Ox.load('Geo', function() {
Ox.load({UI: {}, Geo:{}}, function() {
var $body = $("body"),
$panel = $("<div>")
@ -1202,5 +1201,4 @@ Ox.load('Geo', function() {
})
.appendTo($panel);
});
});

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();
}
}
});
}

View file

@ -185,7 +185,7 @@ Ox.MapMarker = function(options) {
// workaround to prevent marker from appearing twice
// after setting draggable from true to false (google maps bug)
var fix = that.marker.getDraggable() && !that.place.editing;
Ox.print('setOptions, that.map: ', that.map)
//Ox.print('setOptions, that.map: ', that.map)
if (that.map.options('showTypes')) {
that.color = typeColor[that.place.type];
that.size = 8;