This commit is contained in:
rlx 2011-03-04 19:07:41 +00:00
parent 73f5222b34
commit 5d644badd4
2 changed files with 56 additions and 17 deletions

View file

@ -59,8 +59,6 @@ Ox.KEYS = {
';': 186, '=': 187, ',': 188, '-': 189, '.': 190, '/': 191, '`': 192,
'(': 219, '\\': 220, ')': 221, '\'': 222
};
//Ox.MAX_LATITUDE = Ox.deg(Math.atan(Ox.sinh(Math.PI)));
//Ox.MIN_LATITUDE = -Ox.MAX_LATITUDE;
Ox.MONTHS = [
'January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December'
@ -2281,6 +2279,9 @@ Ox.sinh = function(x) {
return (Math.exp(x) - Math.exp(-x)) / 2;
};
Ox.MAX_LATITUDE = Ox.deg(Math.atan(Ox.sinh(Math.PI)));
Ox.MIN_LATITUDE = -Ox.MAX_LATITUDE;
/*
================================================================================
RegExp functions

View file

@ -10416,6 +10416,7 @@ requires
function setOptions() {
that.marker.setOptions({
cursor: that.place.editing ? 'move' : 'pointer',
draggable: that.place.editing,
icon: new google.maps.MarkerImage(
oxui.path + 'png/ox.ui/mapMarker' +
@ -10432,22 +10433,38 @@ requires
}
function dragstart(e) {
}
function drag(e) {
var lat = e.latLng.lat(),
lng = e.latLng.lng();
Ox.print(lat - that.place.lat)
var northSouth = (that.place.north - that.place.south) / 2,
lat = Ox.limit(
e.latLng.lat(),
Ox.MIN_LATITUDE + northSouth,
Ox.MAX_LATITUDE - northSouth
),
lng = e.latLng.lng(),
crossesDateline,
degreesPerMeter = Ox.getDegreesPerMeter(lat);
Ox.print('west', that.place.west, 'east', that.place.east);
that.place.south += lat - that.place.lat;
that.place.north += lat - that.place.lat;
that.place.west = lng - that.place.sizeEastWest * Ox.getDegreesPerMeter(lat) / 2;
that.place.east = lng + that.place.sizeEastWest * Ox.getDegreesPerMeter(lat) / 2;
that.place.west = lng - that.place.sizeEastWest * degreesPerMeter / 2;
that.place.east = lng + that.place.sizeEastWest * degreesPerMeter / 2;
Ox.print('west', that.place.west, 'east', that.place.east);
crossesDateline = that.place.west > that.place.east;
if (that.place.crossesDateline != crossesDateline) {
}
that.place.update();
that.marker.setOptions({
position: that.place.center
})
that.place.polygon.update();
}
function dragend(e) {
}
that.add = function() {
@ -10612,24 +10629,37 @@ requires
});
function dragstart(e) {
that.drag = {
lat: e.latLng.lat(),
lng: e.latLng.lng()
};
}
function drag(e) {
var lat = e.latLng.lat(),
var lat = Ox.limit(e.latLng.lat(), Ox.MIN_LATITUDE, Ox.MAX_LATITUDE),
lng = e.latLng.lng(),
crossesDateline = Math.abs(lng - that.drag.lng) > 180,
degreesPerMeter = Ox.getDegreesPerMeter(that.place.lat);
that.drag = {
lat: lat,
lng: lng
};
Ox.print('e', e)
if (that.position.indexOf('s') > -1) {
that.place.south = Math.min(lat, that.place.north - degreesPerMeter);
}
if (that.position.indexOf('w') > -1) {
that.place.west = Math.min(lng, that.place.east - degreesPerMeter);
that.place.south = lat;
//Math.min(lat, that.place.north - degreesPerMeter);
}
if (that.position.indexOf('n') > -1) {
that.place.north = Math.max(lat, that.place.south + degreesPerMeter);
that.place.north = lat;
//Math.max(lat, that.place.south + degreesPerMeter);
}
if (that.position.indexOf('w') > -1) {
that.place.west = lng;
// Math.min(lng, that.place.east - degreesPerMeter);
}
if (that.position.indexOf('e') > -1) {
that.place.east = Math.max(lng, that.place.west + degreesPerMeter)
that.place.east = lng;
// Math.max(lng, that.place.west + degreesPerMeter)
}
that.place.update();
that.place.marker.update();
@ -10637,7 +10667,15 @@ requires
}
function dragend(e) {
var south;
if (that.place.south > that.place.north) {
south = that.place.south;
that.place.south = that.place.north;
that.place.north = south;
that.place.update();
that.place.marker.update();
that.place.polygon.update();
}
}
that.add = function() {