112
112
if ( inputBinding . locationNameInput ) {
113
113
inputBinding . locationNameInput . val ( gmapContext . locationName ) ;
114
114
}
115
- }
116
-
115
+ }
116
+
117
117
function setupInputListenersInput ( inputBinding , gmapContext ) {
118
118
if ( inputBinding ) {
119
119
if ( inputBinding . radiusInput ) {
120
- inputBinding . radiusInput . on ( "change" , function ( ) {
121
- gmapContext . radius = $ ( this ) . val ( ) ;
122
- GmUtility . setPosition ( gmapContext , gmapContext . location , function ( context ) {
123
- context . settings . onchanged ( GmUtility . locationFromLatLng ( context . location ) , context . radius , false ) ;
124
- } ) ;
125
- } ) ;
120
+ inputBinding . radiusInput . on ( "change" , function ( ) {
121
+ gmapContext . radius = $ ( this ) . val ( ) ;
122
+ GmUtility . setPosition ( gmapContext , gmapContext . location , function ( context ) {
123
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
124
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
125
+ } ) ;
126
+ } ) ;
126
127
}
127
128
if ( inputBinding . locationNameInput && gmapContext . settings . enableAutocomplete ) {
128
129
gmapContext . autocomplete = new google . maps . places . Autocomplete ( inputBinding . locationNameInput . get ( 0 ) ) ;
132
133
gmapContext . settings . onlocationnotfound ( place . name ) ;
133
134
return ;
134
135
}
135
- GmUtility . setPosition ( gmapContext , place . geometry . location , function ( context ) {
136
+ GmUtility . setPosition ( gmapContext , place . geometry . location , function ( context ) {
136
137
updateInputValues ( inputBinding , context ) ;
137
- context . settings . onchanged ( GmUtility . locationFromLatLng ( context . location ) , context . radius , false ) ;
138
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
139
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
138
140
} ) ;
139
141
} ) ;
140
142
}
141
143
if ( inputBinding . latitudeInput ) {
142
- inputBinding . latitudeInput . on ( "change" , function ( ) {
143
- GmUtility . setPosition ( gmapContext , new google . maps . LatLng ( $ ( this ) . val ( ) , gmapContext . location . lng ( ) ) , function ( context ) {
144
- context . settings . onchanged ( GmUtility . locationFromLatLng ( context . location ) , context . radius , false ) ;
145
- } ) ;
146
- } ) ;
144
+ inputBinding . latitudeInput . on ( "change" , function ( ) {
145
+ GmUtility . setPosition ( gmapContext , new google . maps . LatLng ( $ ( this ) . val ( ) , gmapContext . location . lng ( ) ) , function ( context ) {
146
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
147
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
148
+ } ) ;
149
+ } ) ;
147
150
}
148
151
if ( inputBinding . longitudeInput ) {
149
- inputBinding . longitudeInput . on ( "change" , function ( ) {
150
- GmUtility . setPosition ( gmapContext , new google . maps . LatLng ( gmapContext . location . lat ( ) , $ ( this ) . val ( ) ) , function ( context ) {
151
- context . settings . onchanged ( GmUtility . locationFromLatLng ( context . location ) , context . radius , false ) ;
152
- } ) ;
153
- } ) ;
152
+ inputBinding . longitudeInput . on ( "change" , function ( ) {
153
+ GmUtility . setPosition ( gmapContext , new google . maps . LatLng ( gmapContext . location . lat ( ) , $ ( this ) . val ( ) ) , function ( context ) {
154
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
155
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
156
+ } ) ;
157
+ } ) ;
154
158
}
155
159
}
156
160
}
192
196
* - event: string, name of the event
193
197
* - callback: function, callback function to be invoked
194
198
*/
195
- if ( options == undefined ) { // Getter is not available
199
+ if ( params == undefined ) { // Getter is not available
196
200
return null ;
197
201
} else {
198
202
var event = params . event ;
203
207
}
204
208
google . maps . event . addListener ( gmapContext . map , event , callback ) ;
205
209
}
206
-
207
210
break ;
211
+ case "map" :
212
+ /**
213
+ * Returns object which allows access actual google widget and marker paced on it.
214
+ * Structure: {
215
+ * map: Instance of the google map widget
216
+ * marker: marker placed on map
217
+ * }
218
+ */
219
+ if ( params == undefined ) { // Getter is not available
220
+ return {
221
+ map : gmapContext . map ,
222
+ marker : gmapContext . marker
223
+ }
224
+ } else {
225
+ return null ;
226
+ }
208
227
}
209
228
return null ;
210
229
}
233
252
google . maps . event . addListener ( gmapContext . marker , "dragend" , function ( event ) {
234
253
GmUtility . setPosition ( gmapContext , gmapContext . marker . position , function ( context ) {
235
254
var currentLocation = GmUtility . locationFromLatLng ( gmapContext . location ) ;
236
- context . settings . onchanged ( currentLocation , context . radius , true ) ;
255
+ context . settings . onchanged . apply ( gmapContext . domContainer , [ currentLocation , context . radius , true ] ) ;
237
256
updateInputValues ( gmapContext . settings . inputBinding , gmapContext ) ;
238
257
} ) ;
239
258
} ) ;
265
284
266
285
}
267
286
268
- } ( jQuery ) ) ;
287
+ } ( jQuery ) ) ;
0 commit comments