22 * AngularJS directives for Google Maps
33 * git: https://github.com/angular-ui/angular-google-maps.git
44 */
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-
1125
1136/*
1147!
@@ -365,6 +258,116 @@ Nicholas McCready - https://twitter.com/nmccready
365258
366259} ) . call ( this ) ;
367260
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+
368371( function ( ) {
369372 angular . module ( "uiGmapgoogle-maps.directives.api.utils" ) . service ( "uiGmap_sync" , [
370373 function ( ) {
@@ -4955,7 +4958,7 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
49554958 __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 ; } ;
49564959
49574960 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 ) {
49594962 var FreeDrawPolygons ;
49604963 return FreeDrawPolygons = ( function ( _super ) {
49614964 __extends ( FreeDrawPolygons , _super ) ;
@@ -4983,10 +4986,10 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
49834986 return function ( map ) {
49844987 var freeHand , listener ;
49854988 if ( ! scope . polygons ) {
4986- return $log . error ( " No polygons to bind to!" ) ;
4989+ return $log . error ( ' No polygons to bind to!' ) ;
49874990 }
49884991 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!' ) ;
49904993 }
49914994 freeHand = new DrawFreeHandChildModel ( map , scope . originalMapOpts ) ;
49924995 listener = void 0 ;
@@ -5003,7 +5006,7 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
50035006 firstTime = false ;
50045007 return ;
50055008 }
5006- removals = _ . differenceObjects ( oldValue , newValue ) ;
5009+ removals = uiGmapLodash . differenceObjects ( oldValue , newValue ) ;
50075010 return removals . forEach ( function ( p ) {
50085011 return p . setMap ( null ) ;
50095012 } ) ;
@@ -5968,8 +5971,8 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
59685971 __hasProp = { } . hasOwnProperty ,
59695972 __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 ; } ;
59705973
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 ) {
59735976 var Window ;
59745977 return Window = ( function ( _super ) {
59755978 __extends ( Window , _super ) ;
@@ -6019,9 +6022,9 @@ Original idea from: http://stackoverflow.com/questions/22758950/google-map-drawi
60196022 if ( mapCtrl != null ) {
60206023 childWindow = new WindowChildModel ( { } , scope , opts , isIconVisibleOnClick , mapCtrl , markerScope , element ) ;
60216024 this . childWindows . push ( childWindow ) ;
6022- scope . $on ( " $destroy" , ( function ( _this ) {
6025+ scope . $on ( ' $destroy' , ( function ( _this ) {
60236026 return function ( ) {
6024- _this . childWindows = _ . withoutObjects ( _this . childWindows , [ childWindow ] , function ( child1 , child2 ) {
6027+ _this . childWindows = uiGmapLodash . withoutObjects ( _this . childWindows , [ childWindow ] , function ( child1 , child2 ) {
60256028 return child1 . scope . $id === child2 . scope . $id ;
60266029 } ) ;
60276030 return _this . childWindows . length = 0 ;
@@ -9910,7 +9913,7 @@ MarkerWithLabel.prototype.setMap = function (theMap) {
99109913 * Created by Petr Bruna ccg1415 and Nick McCready on 7/13/14.
99119914 */
99129915angular . module ( 'uiGmapgoogle-maps.extensions' )
9913- . service ( 'uiGmapExtendMarkerClusterer' , function ( ) {
9916+ . service ( 'uiGmapExtendMarkerClusterer' , [ 'uiGmapLodash' , function ( uiGmapLodash ) {
99149917 return {
99159918 init : _ . once ( function ( ) {
99169919 ( function ( ) {
@@ -10002,7 +10005,7 @@ angular.module('uiGmapgoogle-maps.extensions')
1000210005 * @return {boolean } True if the marker has already been added.
1000310006 */
1000410007 NgMapCluster . prototype . isMarkerAlreadyAdded_ = function ( marker ) {
10005- return _ . isNullOrUndefined ( this . markers_ . get ( marker . key ) ) ;
10008+ return uiGmapLodash . isNullOrUndefined ( this . markers_ . get ( marker . key ) ) ;
1000610009 } ;
1000710010
1000810011
@@ -10261,4 +10264,4 @@ angular.module('uiGmapgoogle-maps.extensions')
1026110264 } ) . call ( this ) ;
1026210265 } )
1026310266 } ;
10264- } ) ;
10267+ } ] ) ;
0 commit comments