shift click to join places

This commit is contained in:
rolux 2011-06-14 16:34:09 +02:00
parent 7a38795314
commit 4d449232d5
2 changed files with 30 additions and 9 deletions

View file

@ -1220,8 +1220,12 @@ Ox.Map = function(options, self) {
return key; return key;
}; };
that.getSelectedPlace = function() {
return getSelectedPlace();
}
that.editPlace = function() { that.editPlace = function() {
getPlaceById(self.options.selected).edit(); getSelectedPlace().edit();
return that; return that;
}; };
@ -1245,8 +1249,8 @@ Ox.Map = function(options, self) {
}); });
}; };
that.newPlace = function() { that.newPlace = function(place) {
addPlaceToMap(); addPlaceToMap(place);
}; };
that.panToPlace = function() { that.panToPlace = function() {

View file

@ -53,8 +53,24 @@ Ox.MapMarker = function(options) {
function click() { function click() {
if (!that.place.selected) { if (!that.place.selected) {
if (that.map.getKey() == 'shift') {
var bounds = that.map.getSelectedPlace().bounds.union(that.place.bounds),
center = bounds.getCenter(),
southWest = bounds.getSouthWest(),
northEast = bounds.getNorthEast();
that.map.newPlace({
lat: center.lat(),
lng: center.lng(),
south: southWest.lat(),
west: southWest.lng(),
north: northEast.lat(),
east: northEast.lng()
});
} else {
that.map.options({selected: that.place.id}); that.map.options({selected: that.place.id});
} else if (that.map.getKey() == 'meta') { }
} else {
if (that.map.getKey() == 'meta') {
that.map.options({selected: null}); that.map.options({selected: null});
} else if (that.map.getKey() == 'shift') { } else if (that.map.getKey() == 'shift') {
that.map.zoomToPlace(); that.map.zoomToPlace();
@ -62,6 +78,7 @@ Ox.MapMarker = function(options) {
that.map.panToPlace(); that.map.panToPlace();
} }
} }
}
function dragstart(e) { function dragstart(e) {