2
2
* AngularJS directives for Google Maps
3
3
* git: https://github.com/angular-ui/angular-google-maps.git
4
4
*/
5
- ( function ( ) {
6
- String . prototype . contains = function ( value , fromIndex ) {
7
- return this . indexOf ( value , fromIndex ) !== - 1 ;
8
- } ;
9
-
10
- } ) . call ( this ) ;
11
-
12
-
13
- /*
14
- Author Nick McCready
15
- Intersection of Objects if the arrays have something in common each intersecting object will be returned
16
- in an new array.
17
- */
18
-
19
- ( function ( ) {
20
- _ . intersectionObjects = function ( array1 , array2 , comparison ) {
21
- var res ;
22
- if ( comparison == null ) {
23
- comparison = void 0 ;
24
- }
25
- res = _ . map ( array1 , ( function ( _this ) {
26
- return function ( obj1 ) {
27
- return _ . find ( array2 , function ( obj2 ) {
28
- if ( comparison != null ) {
29
- return comparison ( obj1 , obj2 ) ;
30
- } else {
31
- return _ . isEqual ( obj1 , obj2 ) ;
32
- }
33
- } ) ;
34
- } ;
35
- } ) ( this ) ) ;
36
- return _ . filter ( res , function ( o ) {
37
- return o != null ;
38
- } ) ;
39
- } ;
40
-
41
- _ . containsObject = _ . includeObject = function ( obj , target , comparison ) {
42
- if ( comparison == null ) {
43
- comparison = void 0 ;
44
- }
45
- if ( obj === null ) {
46
- return false ;
47
- }
48
- return _ . any ( obj , ( function ( _this ) {
49
- return function ( value ) {
50
- if ( comparison != null ) {
51
- return comparison ( value , target ) ;
52
- } else {
53
- return _ . isEqual ( value , target ) ;
54
- }
55
- } ;
56
- } ) ( this ) ) ;
57
- } ;
58
-
59
- _ . differenceObjects = function ( array1 , array2 , comparison ) {
60
- if ( comparison == null ) {
61
- comparison = void 0 ;
62
- }
63
- return _ . filter ( array1 , function ( value ) {
64
- return ! _ . containsObject ( array2 , value , comparison ) ;
65
- } ) ;
66
- } ;
67
-
68
- _ . withoutObjects = _ . differenceObjects ;
69
-
70
- _ . indexOfObject = function ( array , item , comparison , isSorted ) {
71
- var i , length ;
72
- if ( array == null ) {
73
- return - 1 ;
74
- }
75
- i = 0 ;
76
- length = array . length ;
77
- if ( isSorted ) {
78
- if ( typeof isSorted === "number" ) {
79
- i = ( isSorted < 0 ? Math . max ( 0 , length + isSorted ) : isSorted ) ;
80
- } else {
81
- i = _ . sortedIndex ( array , item ) ;
82
- return ( array [ i ] === item ? i : - 1 ) ;
83
- }
84
- }
85
- while ( i < length ) {
86
- if ( comparison != null ) {
87
- if ( comparison ( array [ i ] , item ) ) {
88
- return i ;
89
- }
90
- } else {
91
- if ( _ . isEqual ( array [ i ] , item ) ) {
92
- return i ;
93
- }
94
- }
95
- i ++ ;
96
- }
97
- return - 1 ;
98
- } ;
99
-
100
- _ [ "extends" ] = function ( arrayOfObjectsToCombine ) {
101
- return _ . reduce ( arrayOfObjectsToCombine , function ( combined , toAdd ) {
102
- return _ . extend ( combined , toAdd ) ;
103
- } , { } ) ;
104
- } ;
105
-
106
- _ . isNullOrUndefined = function ( thing ) {
107
- return _ . isNull ( thing || _ . isUndefined ( thing ) ) ;
108
- } ;
109
-
110
- } ) . call ( this ) ;
111
-
112
5
113
6
/*
114
7
!
@@ -365,6 +258,116 @@ Nicholas McCready - https://twitter.com/nmccready
365
258
366
259
} ) . call ( this ) ;
367
260
261
+ ( function ( ) {
262
+ angular . module ( 'uiGmapgoogle-maps.extensions' ) . service ( 'uiGmapLodash' , function ( ) {
263
+
264
+ /*
265
+ Author Nick McCready
266
+ Intersection of Objects if the arrays have something in common each intersecting object will be returned
267
+ in an new array.
268
+ */
269
+ this . intersectionObjects = function ( array1 , array2 , comparison ) {
270
+ var res ;
271
+ if ( comparison == null ) {
272
+ comparison = void 0 ;
273
+ }
274
+ res = _ . map ( array1 , ( function ( _this ) {
275
+ return function ( obj1 ) {
276
+ return _ . find ( array2 , function ( obj2 ) {
277
+ if ( comparison != null ) {
278
+ return comparison ( obj1 , obj2 ) ;
279
+ } else {
280
+ return _ . isEqual ( obj1 , obj2 ) ;
281
+ }
282
+ } ) ;
283
+ } ;
284
+ } ) ( this ) ) ;
285
+ return _ . filter ( res , function ( o ) {
286
+ return o != null ;
287
+ } ) ;
288
+ } ;
289
+ this . containsObject = _ . includeObject = function ( obj , target , comparison ) {
290
+ if ( comparison == null ) {
291
+ comparison = void 0 ;
292
+ }
293
+ if ( obj === null ) {
294
+ return false ;
295
+ }
296
+ return _ . any ( obj , ( function ( _this ) {
297
+ return function ( value ) {
298
+ if ( comparison != null ) {
299
+ return comparison ( value , target ) ;
300
+ } else {
301
+ return _ . isEqual ( value , target ) ;
302
+ }
303
+ } ;
304
+ } ) ( this ) ) ;
305
+ } ;
306
+ this . differenceObjects = function ( array1 , array2 , comparison ) {
307
+ if ( comparison == null ) {
308
+ comparison = void 0 ;
309
+ }
310
+ return _ . filter ( array1 , ( function ( _this ) {
311
+ return function ( value ) {
312
+ return ! _this . containsObject ( array2 , value , comparison ) ;
313
+ } ;
314
+ } ) ( this ) ) ;
315
+ } ;
316
+ this . withoutObjects = this . differenceObjects ;
317
+ this . indexOfObject = function ( array , item , comparison , isSorted ) {
318
+ var i , length ;
319
+ if ( array == null ) {
320
+ return - 1 ;
321
+ }
322
+ i = 0 ;
323
+ length = array . length ;
324
+ if ( isSorted ) {
325
+ if ( typeof isSorted === "number" ) {
326
+ i = ( isSorted < 0 ? Math . max ( 0 , length + isSorted ) : isSorted ) ;
327
+ } else {
328
+ i = _ . sortedIndex ( array , item ) ;
329
+ return ( array [ i ] === item ? i : - 1 ) ;
330
+ }
331
+ }
332
+ while ( i < length ) {
333
+ if ( comparison != null ) {
334
+ if ( comparison ( array [ i ] , item ) ) {
335
+ return i ;
336
+ }
337
+ } else {
338
+ if ( _ . isEqual ( array [ i ] , item ) ) {
339
+ return i ;
340
+ }
341
+ }
342
+ i ++ ;
343
+ }
344
+ return - 1 ;
345
+ } ;
346
+ this [ "extends" ] = function ( arrayOfObjectsToCombine ) {
347
+ return _ . reduce ( arrayOfObjectsToCombine , function ( combined , toAdd ) {
348
+ return _ . extend ( combined , toAdd ) ;
349
+ } , { } ) ;
350
+ } ;
351
+ this . isNullOrUndefined = function ( thing ) {
352
+ return _ . isNull ( thing || _ . isUndefined ( thing ) ) ;
353
+ } ;
354
+ return this ;
355
+ } ) ;
356
+
357
+ } ) . call ( this ) ;
358
+
359
+ ( function ( ) {
360
+ angular . module ( 'uiGmapgoogle-maps.extensions' ) . factory ( 'uiGmapString' , function ( ) {
361
+ return function ( str ) {
362
+ this . contains = function ( value , fromIndex ) {
363
+ return str . indexOf ( value , fromIndex ) !== - 1 ;
364
+ } ;
365
+ return this ;
366
+ } ;
367
+ } ) ;
368
+
369
+ } ) . call ( this ) ;
370
+
368
371
( function ( ) {
369
372
angular . module ( "uiGmapgoogle-maps.directives.api.utils" ) . service ( "uiGmap_sync" , [
370
373
function ( ) {
@@ -4955,7 +4958,7 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
4955
4958
__extends = function ( child , parent ) { for ( var key in parent ) { if ( __hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ;
4956
4959
4957
4960
angular . module ( 'uiGmapgoogle-maps.directives.api' ) . factory ( 'uiGmapApiFreeDrawPolygons' , [
4958
- " uiGmapLogger" , 'uiGmapBaseObject' , " uiGmapCtrlHandle" , " uiGmapDrawFreeHandChildModel" , function ( $log , BaseObject , CtrlHandle , DrawFreeHandChildModel ) {
4961
+ ' uiGmapLogger' , 'uiGmapBaseObject' , ' uiGmapCtrlHandle' , ' uiGmapDrawFreeHandChildModel' , 'uiGmapLodash' , function ( $log , BaseObject , CtrlHandle , DrawFreeHandChildModel , uiGmapLodash ) {
4959
4962
var FreeDrawPolygons ;
4960
4963
return FreeDrawPolygons = ( function ( _super ) {
4961
4964
__extends ( FreeDrawPolygons , _super ) ;
@@ -4983,10 +4986,10 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
4983
4986
return function ( map ) {
4984
4987
var freeHand , listener ;
4985
4988
if ( ! scope . polygons ) {
4986
- return $log . error ( " No polygons to bind to!" ) ;
4989
+ return $log . error ( ' No polygons to bind to!' ) ;
4987
4990
}
4988
4991
if ( ! _ . isArray ( scope . polygons ) ) {
4989
- return $log . error ( " Free Draw Polygons must be of type Array!" ) ;
4992
+ return $log . error ( ' Free Draw Polygons must be of type Array!' ) ;
4990
4993
}
4991
4994
freeHand = new DrawFreeHandChildModel ( map , scope . originalMapOpts ) ;
4992
4995
listener = void 0 ;
@@ -5003,7 +5006,7 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
5003
5006
firstTime = false ;
5004
5007
return ;
5005
5008
}
5006
- removals = _ . differenceObjects ( oldValue , newValue ) ;
5009
+ removals = uiGmapLodash . differenceObjects ( oldValue , newValue ) ;
5007
5010
return removals . forEach ( function ( p ) {
5008
5011
return p . setMap ( null ) ;
5009
5012
} ) ;
@@ -5968,8 +5971,8 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
5968
5971
__hasProp = { } . hasOwnProperty ,
5969
5972
__extends = function ( child , parent ) { for ( var key in parent ) { if ( __hasProp . call ( parent , key ) ) child [ key ] = parent [ key ] ; } function ctor ( ) { this . constructor = child ; } ctor . prototype = parent . prototype ; child . prototype = new ctor ( ) ; child . __super__ = parent . prototype ; return child ; } ;
5970
5973
5971
- angular . module ( " uiGmapgoogle-maps.directives.api" ) . factory ( " uiGmapWindow" , [
5972
- " uiGmapIWindow" , " uiGmapGmapUtil" , " uiGmapWindowChildModel" , function ( IWindow , GmapUtil , WindowChildModel ) {
5974
+ angular . module ( ' uiGmapgoogle-maps.directives.api' ) . factory ( ' uiGmapWindow' , [
5975
+ ' uiGmapIWindow' , ' uiGmapGmapUtil' , ' uiGmapWindowChildModel' , 'uiGmapLodash' , function ( IWindow , GmapUtil , WindowChildModel , uiGmapLodash ) {
5973
5976
var Window ;
5974
5977
return Window = ( function ( _super ) {
5975
5978
__extends ( Window , _super ) ;
@@ -6019,9 +6022,9 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
6019
6022
if ( mapCtrl != null ) {
6020
6023
childWindow = new WindowChildModel ( { } , scope , opts , isIconVisibleOnClick , mapCtrl , markerScope , element ) ;
6021
6024
this . childWindows . push ( childWindow ) ;
6022
- scope . $on ( " $destroy" , ( function ( _this ) {
6025
+ scope . $on ( ' $destroy' , ( function ( _this ) {
6023
6026
return function ( ) {
6024
- _this . childWindows = _ . withoutObjects ( _this . childWindows , [ childWindow ] , function ( child1 , child2 ) {
6027
+ _this . childWindows = uiGmapLodash . withoutObjects ( _this . childWindows , [ childWindow ] , function ( child1 , child2 ) {
6025
6028
return child1 . scope . $id === child2 . scope . $id ;
6026
6029
} ) ;
6027
6030
return _this . childWindows . length = 0 ;
@@ -9910,7 +9913,7 @@ MarkerWithLabel.prototype.setMap = function (theMap) {
9910
9913
* Created by Petr Bruna ccg1415 and Nick McCready on 7/13/14.
9911
9914
*/
9912
9915
angular . module ( 'uiGmapgoogle-maps.extensions' )
9913
- . service ( 'uiGmapExtendMarkerClusterer' , function ( ) {
9916
+ . service ( 'uiGmapExtendMarkerClusterer' , [ 'uiGmapLodash' , function ( uiGmapLodash ) {
9914
9917
return {
9915
9918
init : _ . once ( function ( ) {
9916
9919
( function ( ) {
@@ -10002,7 +10005,7 @@ angular.module('uiGmapgoogle-maps.extensions')
10002
10005
* @return {boolean } True if the marker has already been added.
10003
10006
*/
10004
10007
NgMapCluster . prototype . isMarkerAlreadyAdded_ = function ( marker ) {
10005
- return _ . isNullOrUndefined ( this . markers_ . get ( marker . key ) ) ;
10008
+ return uiGmapLodash . isNullOrUndefined ( this . markers_ . get ( marker . key ) ) ;
10006
10009
} ;
10007
10010
10008
10011
@@ -10261,4 +10264,4 @@ angular.module('uiGmapgoogle-maps.extensions')
10261
10264
} ) . call ( this ) ;
10262
10265
} )
10263
10266
} ;
10264
- } ) ;
10267
+ } ] ) ;
0 commit comments