diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index 9f23d1c4..2a12507e 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -1220,8 +1220,12 @@ Ox.Map = function(options, self) { return key; }; + that.getSelectedPlace = function() { + return getSelectedPlace(); + } + that.editPlace = function() { - getPlaceById(self.options.selected).edit(); + getSelectedPlace().edit(); return that; }; @@ -1245,8 +1249,8 @@ Ox.Map = function(options, self) { }); }; - that.newPlace = function() { - addPlaceToMap(); + that.newPlace = function(place) { + addPlaceToMap(place); }; that.panToPlace = function() { diff --git a/source/Ox.UI/js/Map/Ox.MapMarker.js b/source/Ox.UI/js/Map/Ox.MapMarker.js index 2bb563a6..86e8b0fd 100644 --- a/source/Ox.UI/js/Map/Ox.MapMarker.js +++ b/source/Ox.UI/js/Map/Ox.MapMarker.js @@ -53,13 +53,30 @@ Ox.MapMarker = function(options) { function click() { if (!that.place.selected) { - that.map.options({selected: that.place.id}); - } else if (that.map.getKey() == 'meta') { - that.map.options({selected: null}); - } else if (that.map.getKey() == 'shift') { - that.map.zoomToPlace(); + 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}); + } } else { - that.map.panToPlace(); + if (that.map.getKey() == 'meta') { + that.map.options({selected: null}); + } else if (that.map.getKey() == 'shift') { + that.map.zoomToPlace(); + } else { + that.map.panToPlace(); + } } }