shift click to join places, part 3

This commit is contained in:
rolux 2011-06-14 16:41:20 +02:00
parent bf64450ada
commit 6162b0cc33
2 changed files with 5 additions and 10 deletions

View file

@ -382,10 +382,10 @@ Ox.Map = function(options, self) {
function addPlaceToMap(place) { function addPlaceToMap(place) {
// via find, click, or new place button // via find, click, or new place button
var bounds, exists = false; var exists = false;
if (!place) { if (!place) {
bounds = self.map.getBounds(); var bounds = self.map.getBounds(),
var center = self.map.getCenter(), center = self.map.getCenter(),
southwest = new google.maps.LatLngBounds( southwest = new google.maps.LatLngBounds(
bounds.getSouthWest(), center bounds.getSouthWest(), center
).getCenter(), ).getCenter(),
@ -408,11 +408,6 @@ Ox.Map = function(options, self) {
north: northeast.lat(), north: northeast.lat(),
east: northeast.lng() east: northeast.lng()
}); });
} else {
bounds = new google.maps.LatLngBounds(
new google.maps.LatLng(place.south, place.west),
new google.maps.LatLng(place.north, place.east)
);
} }
Ox.forEach(self.places, function(p, i) { Ox.forEach(self.places, function(p, i) {
if (place.bounds.equals(p.bounds)) { if (place.bounds.equals(p.bounds)) {

View file

@ -58,14 +58,14 @@ Ox.MapMarker = function(options) {
center = bounds.getCenter(), center = bounds.getCenter(),
southWest = bounds.getSouthWest(), southWest = bounds.getSouthWest(),
northEast = bounds.getNorthEast(); northEast = bounds.getNorthEast();
that.map.newPlace({ that.map.newPlace(new Ox.MapPlace({
lat: center.lat(), lat: center.lat(),
lng: center.lng(), lng: center.lng(),
south: southWest.lat(), south: southWest.lat(),
west: southWest.lng(), west: southWest.lng(),
north: northEast.lat(), north: northEast.lat(),
east: northEast.lng() east: northEast.lng()
}); }));
} else { } else {
that.map.options({selected: that.place.id}); that.map.options({selected: that.place.id});
} }