Skip to content

Commit aca653b

Browse files
committed
Fixes #10. Allow configuring precision.
1 parent aa45f89 commit aca653b

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

src/controllers/angulargmMapController.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@
2222
var gMContainer = angulargmContainer;
2323

2424

25-
/** constants */
26-
var consts = {};
27-
consts.precision = 3;
28-
29-
3025
/*
3126
* Construct a new controller for the gmMap directive.
3227
* @param {angular.Scope} $scope
@@ -54,7 +49,7 @@
5449

5550
Object.defineProperties(this, {
5651
'precision': {
57-
value: consts.precision,
52+
value: gMDefaults.precision,
5853
writeable: false
5954
},
6055

src/directives/gmMarkers.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
var latLngEqual = angulargmUtils.latLngEqual;
132132
var objToLatLng = angulargmUtils.objToLatLng;
133133
var getEventHandlers = angulargmUtils.getEventHandlers;
134+
var createHash = angulargmUtils.createHash;
134135

135136

136137
function link(scope, element, attrs, controller) {
@@ -158,7 +159,7 @@
158159
var markerOptions = scope.gmGetMarkerOptions({object: object});
159160

160161
// hash objects for quick access
161-
var hash = position.toUrlValue(controller.precision);
162+
var hash = angulargmUtils.createHash(position, controller.precision);
162163
objectHash[hash] = object;
163164

164165
// add marker

src/module.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
* angular.module('myModule').config(function($provide) {
5353
* $provide.decorator('angulargmDefaults', function($delegate) {
5454
* return angular.extend($delegate, {
55+
* 'precision': 3,
5556
* 'markerConstructor': myCustomMarkerConstructor,
57+
* 'polylineConstructor': myCustomPolylineConstructor,
5658
* 'mapOptions': {
5759
* center: new google.maps.LatLng(55, 111),
5860
* mapTypeId: google.maps.MapTypeId.SATELLITE,
@@ -64,6 +66,7 @@
6466
* ```
6567
*/
6668
value('angulargmDefaults', {
69+
'precision': 3,
6770
'markerConstructor': google.maps.Marker,
6871
'polylineConstructor': google.maps.Polyline,
6972
'mapOptions': {

0 commit comments

Comments
 (0)