Ox.Map: meta+click on selected place now deselects it (fixes #655)
This commit is contained in:
parent
c0c4031825
commit
fa146ebbba
3 changed files with 24 additions and 11 deletions
|
@ -23,7 +23,8 @@ Ox.Keyboard = (function() {
|
|||
|
||||
Ox.forEach(Ox.MODIFIER_KEYS, function(v, k) {
|
||||
// avoid pushing modifier twice
|
||||
// using event.originalEvent since jquery always sets event.metaKey to event.ctrlKey
|
||||
// using event.originalEvent since jquery always sets
|
||||
// event.metaKey to event.ctrlKey
|
||||
if (event.originalEvent[k] && keyBasename != v) {
|
||||
keyNames.splice(-1, 0, v);
|
||||
}
|
||||
|
|
|
@ -142,7 +142,16 @@ Ox.Map = function(options, self) {
|
|||
key_left: function() {
|
||||
pan(-1, 0);
|
||||
},
|
||||
key_meta: function() {
|
||||
// FIXME:
|
||||
'key_meta.left': function() {
|
||||
self.metaKey = true;
|
||||
$(document).one({
|
||||
keyup: function() {
|
||||
self.metaKey = false;
|
||||
}
|
||||
});
|
||||
},
|
||||
'key_meta.right': function() {
|
||||
self.metaKey = true;
|
||||
$(document).one({
|
||||
keyup: function() {
|
||||
|
|
|
@ -52,14 +52,17 @@ Ox.MapMarker = function(options) {
|
|||
setOptions();
|
||||
|
||||
function click() {
|
||||
var key = that.map.getKey(),
|
||||
place, bounds, southWest, northEast;
|
||||
if (!that.place.selected) {
|
||||
if (that.map.getKey() == 'shift') {
|
||||
var place = that.map.getSelectedPlace(),
|
||||
bounds = new google.maps.LatLngBounds(
|
||||
new google.maps.LatLng(place.south, place.west),
|
||||
new google.maps.LatLng(place.north, place.east)
|
||||
),
|
||||
southWest, northEast;
|
||||
if (key == 'meta' || key == 'shift') {
|
||||
place = that.map.getSelectedPlace();
|
||||
}
|
||||
if (place) {
|
||||
bounds = new google.maps.LatLngBounds(
|
||||
new google.maps.LatLng(place.south, place.west),
|
||||
new google.maps.LatLng(place.north, place.east)
|
||||
);
|
||||
bounds = bounds.union(that.place.bounds);
|
||||
southWest = bounds.getSouthWest();
|
||||
northEast = bounds.getNorthEast();
|
||||
|
@ -82,7 +85,7 @@ Ox.MapMarker = function(options) {
|
|||
that.map.options({selected: that.place.id});
|
||||
}
|
||||
} else {
|
||||
if (that.map.getKey() == 'meta') {
|
||||
if (key == 'meta') {
|
||||
that.map.options({selected: null});
|
||||
} else {
|
||||
that.map.panToPlace();
|
||||
|
|
Loading…
Reference in a new issue