Skip to content

Commit 4310679

Browse files
committed
Version 1.13.4
1 parent 518b05b commit 4310679

File tree

6 files changed

+59
-12
lines changed

6 files changed

+59
-12
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngmap",
3-
"version": "1.13.3",
3+
"version": "1.13.4",
44
"main": "./build/scripts/ng-map.js",
55
"homepage": "https://github.com/allenhwkim/angularjs-google-maps",
66
"authors": [

build/docs/source/directions.html

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ <h1 class="title">
147147
}
148148
return renderer;
149149
};
150-
var directions = function(Attr2Options, $timeout) {
150+
var directions = function(Attr2Options, $timeout, NavigatorGeolocation) {
151151
var parser = Attr2Options;
152152
var directionsService = new google.maps.DirectionsService();
153153
var updateRoute = function(renderer, options) {
@@ -166,7 +166,7 @@ <h1 class="title">
166166
// Check fo valid values
167167
if(request.waypoints == "[]" || request.waypoints == "") delete request.waypoints;
168168
}
169-
if (request.origin && request.destination) {
169+
var showDirections = function(request) {
170170
console.log('request', request);
171171
directionsService.route(request, function(response, status) {
172172
if (status == google.maps.DirectionsStatus.OK) {
@@ -175,6 +175,21 @@ <h1 class="title">
175175
});
176176
}
177177
});
178+
};
179+
if (request.origin && request.destination) {
180+
if (request.origin == 'current-location') {
181+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
182+
request.origin = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
183+
showDirections(request);
184+
});
185+
} else if (request.destination == 'current-location') {
186+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
187+
request.destination = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
188+
showDirections(request);
189+
});
190+
} else {
191+
showDirections(request);
192+
}
178193
}
179194
};
180195
var linkFunc = function(scope, element, attrs, mapController) {
@@ -216,7 +231,7 @@ <h1 class="title">
216231
link: linkFunc
217232
}
218233
}; // var directions
219-
directions.$inject = ['Attr2Options', '$timeout'];
234+
directions.$inject = ['Attr2Options', '$timeout', 'NavigatorGeolocation'];
220235
angular.module('ngMap').directive('directions', directions);
221236
})();
222237
</code></pre>

build/scripts/ng-map.debug.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ angular.module('ngMap', []);
870870
return renderer;
871871
};
872872

873-
var directions = function(Attr2Options, $timeout) {
873+
var directions = function(Attr2Options, $timeout, NavigatorGeolocation) {
874874
var parser = Attr2Options;
875875
var directionsService = new google.maps.DirectionsService();
876876

@@ -892,7 +892,7 @@ angular.module('ngMap', []);
892892
if(request.waypoints == "[]" || request.waypoints == "") delete request.waypoints;
893893
}
894894

895-
if (request.origin && request.destination) {
895+
var showDirections = function(request) {
896896
console.log('request', request);
897897
directionsService.route(request, function(response, status) {
898898
if (status == google.maps.DirectionsStatus.OK) {
@@ -901,6 +901,22 @@ angular.module('ngMap', []);
901901
});
902902
}
903903
});
904+
};
905+
906+
if (request.origin && request.destination) {
907+
if (request.origin == 'current-location') {
908+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
909+
request.origin = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
910+
showDirections(request);
911+
});
912+
} else if (request.destination == 'current-location') {
913+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
914+
request.destination = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
915+
showDirections(request);
916+
});
917+
} else {
918+
showDirections(request);
919+
}
904920
}
905921
};
906922

@@ -947,7 +963,7 @@ angular.module('ngMap', []);
947963
link: linkFunc
948964
}
949965
}; // var directions
950-
directions.$inject = ['Attr2Options', '$timeout'];
966+
directions.$inject = ['Attr2Options', '$timeout', 'NavigatorGeolocation'];
951967

952968
angular.module('ngMap').directive('directions', directions);
953969
})();

build/scripts/ng-map.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ angular.module('ngMap', []);
870870
return renderer;
871871
};
872872

873-
var directions = function(Attr2Options, $timeout) {
873+
var directions = function(Attr2Options, $timeout, NavigatorGeolocation) {
874874
var parser = Attr2Options;
875875
var directionsService = new google.maps.DirectionsService();
876876

@@ -892,7 +892,7 @@ angular.module('ngMap', []);
892892
if(request.waypoints == "[]" || request.waypoints == "") delete request.waypoints;
893893
}
894894

895-
if (request.origin && request.destination) {
895+
var showDirections = function(request) {
896896
void 0;
897897
directionsService.route(request, function(response, status) {
898898
if (status == google.maps.DirectionsStatus.OK) {
@@ -901,6 +901,22 @@ angular.module('ngMap', []);
901901
});
902902
}
903903
});
904+
};
905+
906+
if (request.origin && request.destination) {
907+
if (request.origin == 'current-location') {
908+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
909+
request.origin = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
910+
showDirections(request);
911+
});
912+
} else if (request.destination == 'current-location') {
913+
NavigatorGeolocation.getCurrentPosition().then(function(ll) {
914+
request.destination = new google.maps.LatLng(ll.coords.latitude, ll.coords.longitude);
915+
showDirections(request);
916+
});
917+
} else {
918+
showDirections(request);
919+
}
904920
}
905921
};
906922

@@ -947,7 +963,7 @@ angular.module('ngMap', []);
947963
link: linkFunc
948964
}
949965
}; // var directions
950-
directions.$inject = ['Attr2Options', '$timeout'];
966+
directions.$inject = ['Attr2Options', '$timeout', 'NavigatorGeolocation'];
951967

952968
angular.module('ngMap').directive('directions', directions);
953969
})();

build/scripts/ng-map.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngmap",
3-
"version": "1.13.3",
3+
"version": "1.13.4",
44
"main": "build/scripts/ng-map.js",
55
"dependencies": {
66
"glob": "~4.0.2",

0 commit comments

Comments
 (0)