From 3847a697aa722c0a6cc9403241c9c28c8724cd51 Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Sat, 3 Jul 2010 13:24:17 -0600 Subject: [PATCH 1/4] show the whole world if no data points are available --- jquery.jmapping.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/jquery.jmapping.js b/jquery.jmapping.js index 815af31..9e16560 100644 --- a/jquery.jmapping.js +++ b/jquery.jmapping.js @@ -87,12 +87,17 @@ if (GMap2){ var getBounds = function(){ var places_data = getPlacesData(); - var newBounds = new GLatLngBounds( - $.jMapping.makeGLatLng(places_data[0].point), - $.jMapping.makeGLatLng(places_data[0].point) ); + var newBounds; + if (places_data.length > 0) { + newBounds = new GLatLngBounds( + $.jMapping.makeGLatLng(places_data[0].point), + $.jMapping.makeGLatLng(places_data[0].point) ); - for (var i=1, len = places_data.length ; i Date: Mon, 5 Jul 2010 19:56:42 -0600 Subject: [PATCH 2/4] don't cache metadata so that dynamically changed place data will get picked up --- jquery.jmapping.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jquery.jmapping.js b/jquery.jmapping.js index 9e16560..370e6d7 100644 --- a/jquery.jmapping.js +++ b/jquery.jmapping.js @@ -81,6 +81,7 @@ if (GMap2){ var getPlacesData = function(){ return places.map(function(){ + $(this).data('metadata', false); // don't cache the metadata return $(this).metadata(settings.metadata_options); }); }; From a2cf009940a477d6541c351cdf7f1dd8d614abe4 Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Sun, 13 Feb 2011 18:19:50 -0700 Subject: [PATCH 3/4] fixed documentation of default value for metadata_options --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 9dd91ae..c2af050 100644 --- a/README.markdown +++ b/README.markdown @@ -105,7 +105,7 @@ These are options that can be passed to the `jMapping` function to change specif * *Default*: `{lat: 0.0, lng: 0.0}` * This point determines the Google Maps location if there are no location elements inside the specified `location_selector`. * `metadata_options`: - * *Default*: `{type: "attr", name: "data"}` + * *Default*: `{type: "attr", name: "data-jmapping"}` * This is the set of options passed to the jQuery metadata function. It defines how the necessary metadata for each location will be searched for. See the [metadata plugins docs](http://docs.jquery.com/Plugins/Metadata/metadata#toptions) for more info. From 5f7414b9f40b80ddebbbb2529f6515e5655fe22b Mon Sep 17 00:00:00 2001 From: Tom Anderson Date: Sat, 19 Feb 2011 11:27:23 -0700 Subject: [PATCH 4/4] added the 'bounded' attribute to the data object so that a place can be excluded from the bounds calculation --- README.markdown | 6 ++++++ jquery.jmapping.js | 26 ++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.markdown b/README.markdown index c2af050..aad9c6b 100644 --- a/README.markdown +++ b/README.markdown @@ -54,6 +54,12 @@ Make sure your HTML has a `div` element for the Google map, and there is a conta

Example Text.

+
+ A Place outside the bounds of the map +
+

You might have to pan/zoom to see this location.

+
+
Then just call the `jMapping` function on the map element: diff --git a/jquery.jmapping.js b/jquery.jmapping.js index 555d387..473f591 100644 --- a/jquery.jmapping.js +++ b/jquery.jmapping.js @@ -103,17 +103,23 @@ var getBounds = function(doUpdate){ var places_data = getPlacesData(doUpdate), - newBounds, initialPoint; - - if (places_data.length){ - initialPoint = $.jMapping.makeGLatLng(places_data[0].point); - }else{ - initialPoint = $.jMapping.makeGLatLng(settings.default_point); - } - newBounds = new google.maps.LatLngBounds(initialPoint, initialPoint); + newBounds = null, point; - for (var i=1, len = places_data.length; i