From 23c50a1d01d0c442219bf348777305110656e4fe Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 14 Jun 2011 11:29:31 +0200 Subject: [PATCH] update map (for arctic/antartic results) --- source/Ox.UI/js/Map/Ox.Map.js | 16 ++++++++++++---- source/Ox.js | 4 ++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Map/Ox.Map.js b/source/Ox.UI/js/Map/Ox.Map.js index 48a0ddb6..d133a353 100644 --- a/source/Ox.UI/js/Map/Ox.Map.js +++ b/source/Ox.UI/js/Map/Ox.Map.js @@ -851,22 +851,30 @@ Ox.Map = function(options, self) { function parseGeodata(data) { var bounds = data.geometry.bounds || data.geometry.viewport, + northEast = bounds.getNorthEast(), + southWest = bounds.getSouthWest(), place = { alternativeNames: [], components: data.address_components, countryCode: getCountryCode(data.address_components), - east: bounds.getNorthEast().lng(), + east: northEast.lng(), editable: self.options.editable, fullGeoname: getFullGeoname(data.address_components), geoname: data.formatted_address, id: '_' + Ox.encodeBase32(Ox.uid()), map: that, name: data.formatted_address.split(', ')[0], - north: bounds.getNorthEast().lat(), - south: bounds.getSouthWest().lat(), + north: northEast.lat(), + south: southWest.lat(), type: getType(data.address_components[0].types), - west: bounds.getSouthWest().lng() + west: southWest.lng() }; + if (place.west == -180 && place.east == 180) { + place.west = -179.99999999; + place.east = 179.99999999; + } + place.south = Ox.limit(place.south, Ox.MIN_LATITUDE, Ox.MAX_LATITUDE); + place.north = Ox.limit(place.north, Ox.MIN_LATITUDE, Ox.MAX_LATITUDE); function getCountryCode(components) { countryCode = ''; Ox.forEach(components, function(component) { diff --git a/source/Ox.js b/source/Ox.js index 9fd009ed..09b1f291 100644 --- a/source/Ox.js +++ b/source/Ox.js @@ -2388,8 +2388,8 @@ Ox.formatDateRange = function(start, end, utc) { /*@ Ox.formatDateRangeDuration Formats the duration of a date range as a string A date range is a pair of arbitrary-presicion date strings - > Ox.formatDateRangeDuration('2000-01-01 00:00:00', '2001-01-03 03:04:05') - '1 year 2 days 3 hours 4 minutes 5 seconds' + > Ox.formatDateRangeDuration('2000-01-01 00:00:00', '2001-03-04 04:05:06') + '1 year 2 months 3 days 4 hours 5 minutes 6 seconds' > Ox.formatDateRangeDuration('1999', '2000', true) '1 year' > Ox.formatDateRangeDuration('2000', '2001', true)