Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Commit

Permalink
gmaps.js v0.4.7
Browse files Browse the repository at this point in the history
  • Loading branch information
hpneo committed Nov 2, 2013
1 parent 3c25304 commit d61737b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Changelog
-----------------------
* Add callback for failure in getRoutes
* Update marker clusterer after remove marker
* Add support for string arrays to arrayToLatLng

0.4.6
-----------------------
Expand Down
23 changes: 18 additions & 5 deletions gmaps.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* GMaps.js v0.4.6
* GMaps.js v0.4.7
* http://hpneo.github.com/gmaps/
*
* Copyright 2013, Gustavo Leon
Expand Down Expand Up @@ -92,7 +92,7 @@ var arrayToLatLng = function(coords, useGeoJSON) {
var i;

for (i = 0; i < coords.length; i++) {
if (coords[i].length > 0 && typeof(coords[i][0]) != "number") {
if (coords[i].length > 0 && typeof(coords[i][0]) == "object") {
coords[i] = arrayToLatLng(coords[i], useGeoJSON);
}
else {
Expand Down Expand Up @@ -666,6 +666,10 @@ GMaps.prototype.removeMarker = function(marker) {
this.markers[i].setMap(null);
this.markers.splice(i, 1);

if(this.markerClusterer) {
this.markerClusterer.removeMarker(marker);
}

GMaps.fire('marker_removed', marker, this);

break;
Expand Down Expand Up @@ -1234,10 +1238,15 @@ GMaps.prototype.getRoutes = function(options) {
self.routes.push(result.routes[r]);
}
}
}

if (options.callback) {
options.callback(self.routes);
if (options.callback) {
options.callback(self.routes);
}
}
else {
if (options.error) {
options.error(result, status);
}
}
});
};
Expand Down Expand Up @@ -1300,6 +1309,7 @@ GMaps.prototype.drawRoute = function(options) {
travelMode: options.travelMode,
waypoints: options.waypoints,
unitSystem: options.unitSystem,
error: options.error,
callback: function(e) {
if (e.length > 0) {
self.drawPolyline({
Expand All @@ -1324,6 +1334,7 @@ GMaps.prototype.travelRoute = function(options) {
destination: options.destination,
travelMode: options.travelMode,
waypoints : options.waypoints,
error: options.error,
callback: function(e) {
//start callback
if (e.length > 0 && options.start) {
Expand Down Expand Up @@ -1369,6 +1380,7 @@ GMaps.prototype.drawSteppedRoute = function(options) {
destination: options.destination,
travelMode: options.travelMode,
waypoints : options.waypoints,
error: options.error,
callback: function(e) {
//start callback
if (e.length > 0 && options.start) {
Expand Down Expand Up @@ -1444,6 +1456,7 @@ GMaps.Route.prototype.getRoute = function(options) {
destination : this.destination,
travelMode : options.travelMode,
waypoints : this.waypoints || [],
error: options.error,
callback : function() {
self.route = e[0];

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gmaps",
"version": "0.4.6",
"version": "0.4.7",
"description": "the easiest way to use Google Maps",
"main": "gmaps.js",
"scripts": {
Expand Down

0 comments on commit d61737b

Please sign in to comment.