replace tabs with spaces

This commit is contained in:
rolux 2012-08-29 17:42:50 +02:00
parent c4c49fd1d1
commit 8572f93334

View file

@ -88,12 +88,12 @@ Ox.Map = function(options, self) {
.defaults({
// fixme: isClickable?
clickable: false,
editable: false,
find: '',
findPlaceholder: 'Find',
keys: [],
markerColor: 'auto',
markerSize: 'auto',
editable: false,
find: '',
findPlaceholder: 'Find',
keys: [],
markerColor: 'auto',
markerSize: 'auto',
maxMarkers: 100,
places: null,
selected: '',
@ -160,86 +160,86 @@ Ox.Map = function(options, self) {
}
})
.addClass('OxMap')
.bindEvent({
gainfocus: function() {
self.options.zoomOnlyWhenFocused && self.map.setOptions({scrollwheel: true});
},
losefocus: function() {
self.options.zoomOnlyWhenFocused && self.map.setOptions({scrollwheel: false});
},
key_0: function() {
panToPlace()
},
key_c: toggleControls,
.bindEvent({
gainfocus: function() {
self.options.zoomOnlyWhenFocused && self.map.setOptions({scrollwheel: true});
},
losefocus: function() {
self.options.zoomOnlyWhenFocused && self.map.setOptions({scrollwheel: false});
},
key_0: function() {
panToPlace()
},
key_c: toggleControls,
key_down: function() {
pan(0, 1);
},
pan(0, 1);
},
key_enter: pressEnter,
key_escape: pressEscape,
key_equal: function() {
zoom(1);
},
key_l: toggleLabels,
key_equal: function() {
zoom(1);
},
key_l: toggleLabels,
key_left: function() {
pan(-1, 0);
},
// 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() {
self.metaKey = false;
}
});
},
key_minus: function() {
zoom(-1);
},
pan(-1, 0);
},
// 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() {
self.metaKey = false;
}
});
},
key_minus: function() {
zoom(-1);
},
key_right: function() {
pan(1, 0);
},
key_shift: function() {
self.shiftKey = true;
$(document).one({
keyup: function() {
self.shiftKey = false;
}
});
},
key_shift_down: function() {
pan(0, 2);
},
key_shift_0: function() {
zoomToPlace();
},
key_shift_equal: function() {
zoom(2);
},
key_shift_left: function() {
pan(-2, 0);
},
key_shift_minus: function() {
zoom(-2);
},
key_shift_right: function() {
pan(2, 0);
},
key_shift_up: function() {
pan(0, -2);
},
pan(1, 0);
},
key_shift: function() {
self.shiftKey = true;
$(document).one({
keyup: function() {
self.shiftKey = false;
}
});
},
key_shift_down: function() {
pan(0, 2);
},
key_shift_0: function() {
zoomToPlace();
},
key_shift_equal: function() {
zoom(2);
},
key_shift_left: function() {
pan(-2, 0);
},
key_shift_minus: function() {
zoom(-2);
},
key_shift_right: function() {
pan(2, 0);
},
key_shift_up: function() {
pan(0, -2);
},
key_up: function() {
pan(0, -1);
},
key_z: undo,
mousedown: function(e) {
pan(0, -1);
},
key_z: undo,
mousedown: function(e) {
!$(e.target).is('input') && that.gainFocus();
}
});
@ -580,9 +580,9 @@ Ox.Map = function(options, self) {
name: '',
type: 'feature',
south: southwest.lat(),
west: southwest.lng(),
north: northeast.lat(),
east: northeast.lng()
west: southwest.lng(),
north: northeast.lat(),
east: northeast.lng()
});
}
Ox.forEach(self.places, function(p, i) {
@ -641,8 +641,8 @@ Ox.Map = function(options, self) {
function clickMap(event) {
var place = getSelectedPlace();
if (self.options.clickable/* && !editing()*/) {
getPlaceByLatLng(event.latLng, self.map.getBounds(), function(place) {
if (self.options.clickable/* && !editing()*/) {
getPlaceByLatLng(event.latLng, self.map.getBounds(), function(place) {
if (place) {
addPlaceToMap(place);
//selectPlace(place.id);
@ -650,9 +650,9 @@ Ox.Map = function(options, self) {
selectPlace(null);
}
});
} else {
pressEscape();
}
} else {
pressEscape();
}
}
function clickPlaceButton() {
@ -826,16 +826,16 @@ Ox.Map = function(options, self) {
});
}
function getPositionByName(name) {
var position = -1;
Ox.forEach(self.options.places, function(place, i) {
if (place.name == name) {
position = i;
return false; // break
}
});
return position;
}
function getPositionByName(name) {
var position = -1;
Ox.forEach(self.options.places, function(place, i) {
if (place.name == name) {
position = i;
return false; // break
}
});
return position;
}
function getSelectedMarker() {
// needed in case self.options.selected
@ -931,8 +931,8 @@ Ox.Map = function(options, self) {
}
updateFormElements();
self.loaded = true;
that.triggerEvent('load');
self.loaded = true;
that.triggerEvent('load');
});
@ -1036,20 +1036,20 @@ Ox.Map = function(options, self) {
formatTerms();
}
function pan(x, y) {
self.map.panBy(x * self.$map.width() / 2, y * self.$map.height() / 2);
};
function pan(x, y) {
self.map.panBy(x * self.$map.width() / 2, y * self.$map.height() / 2);
};
function panToPlace() {
var place;
if (!self.loaded) {
if (!self.loaded) {
setTimeout(function() {
panToPlace();
}, 100);
} else {
place = getSelectedPlace();
place && self.map.panTo(place.center);
}
place = getSelectedPlace();
place && self.map.panTo(place.center);
}
}
function parseGeodata(data) {
@ -1059,18 +1059,18 @@ Ox.Map = function(options, self) {
place = {
alternativeNames: [],
components: data.address_components,
countryCode: getCountryCode(data.address_components),
east: northEast.lng(),
editable: self.options.editable,
fullGeoname: getFullGeoname(data.address_components),
id: '_' + Ox.encodeBase32(Ox.uid()),
map: that,
north: northEast.lat(),
south: southWest.lat(),
type: getType(data.address_components[0].types),
west: southWest.lng()
countryCode: getCountryCode(data.address_components),
east: northEast.lng(),
editable: self.options.editable,
fullGeoname: getFullGeoname(data.address_components),
id: '_' + Ox.encodeBase32(Ox.uid()),
map: that,
north: northEast.lat(),
south: southWest.lat(),
type: getType(data.address_components[0].types),
west: southWest.lng()
};
place.geoname = data.formatted_address || place.fullGeoname;
place.geoname = data.formatted_address || place.fullGeoname;
place.name = (place.geoname || place.fullGeoname).split(', ')[0];
if (Math.abs(place.west) == 180 && Math.abs(place.east) == 180) {
place.west = -179.99999999;
@ -1098,7 +1098,7 @@ Ox.Map = function(options, self) {
return !country && (
i == 0 || name != components[i - 1].long_name
) ? name : null;
}).join(', ');
}).join(', ');
}
function getType(types) {
// see https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes
@ -1140,7 +1140,7 @@ Ox.Map = function(options, self) {
});
return type || 'feature';
}
return place;
return place;
}
function pressEnter() {
@ -1182,11 +1182,11 @@ Ox.Map = function(options, self) {
place.rectangle.update();
}
function reset() {
self.map.getZoom() == self.zoom
? self.map.panTo(self.center)
: self.map.fitBounds(self.bounds);
}
function reset() {
self.map.getZoom() == self.zoom
? self.map.panTo(self.center)
: self.map.fitBounds(self.bounds);
}
function selectPlace(id, zoom) {
// id can be null (deselect)
@ -1432,9 +1432,9 @@ Ox.Map = function(options, self) {
}
}
function zoom(z) {
self.map.setZoom(self.map.getZoom() + z);
}
function zoom(z) {
self.map.setZoom(self.map.getZoom() + z);
}
function zoomChanged() {
var zoom = self.map.getZoom();
@ -1451,17 +1451,17 @@ Ox.Map = function(options, self) {
}
}
function zoomToPlace() {
var place;
if (!self.loaded) {
function zoomToPlace() {
var place;
if (!self.loaded) {
setTimeout(function() {
zoomToPlace();
}, 100);
} else {
place = getSelectedPlace();
place && self.map.fitBounds(place.bounds);
}
}
place = getSelectedPlace();
place && self.map.fitBounds(place.bounds);
}
}
/*@
addPlace <f> addPlace
@ -1495,7 +1495,7 @@ Ox.Map = function(options, self) {
@*/
that.editPlace = function() {
getSelectedPlace().edit();
return that;
return that;
};
/*@
@ -1528,10 +1528,10 @@ Ox.Map = function(options, self) {
panToPlace <f> panToPlace
() -> <o> pan to place
@*/
that.panToPlace = function() {
panToPlace();
return that;
};
that.panToPlace = function() {
panToPlace();
return that;
};
/*@
removePlace <f> removePlace
@ -1540,7 +1540,7 @@ Ox.Map = function(options, self) {
that.removePlace = function() {
// fixme: removePlaceFromPlaces() ?
removePlace();
return that;
return that;
};
/*@
@ -1571,7 +1571,7 @@ Ox.Map = function(options, self) {
google.maps.event.trigger(self.map, 'resize');
// self.map.setCenter(center);
}
return that;
return that;
}
/*@
@ -1602,7 +1602,7 @@ Ox.Map = function(options, self) {
@*/
that.zoomToPlace = function() {
zoomToPlace();
return that;
return that;
};
/*@
@ -1611,7 +1611,7 @@ Ox.Map = function(options, self) {
@*/
that.zoom = function(value) {
zoom(value);
return that;
return that;
};
return that;