File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 176
176
} ) ;
177
177
}
178
178
if ( inputBinding . locationNameInput && gmapContext . settings . enableAutocomplete ) {
179
+ var blur = false ;
179
180
gmapContext . autocomplete = new google . maps . places . Autocomplete ( inputBinding . locationNameInput . get ( 0 ) ) ;
180
181
google . maps . event . addListener ( gmapContext . autocomplete , 'place_changed' , function ( ) {
182
+ blur = false ;
181
183
var place = gmapContext . autocomplete . getPlace ( ) ;
182
184
if ( ! place . geometry ) {
183
185
gmapContext . settings . onlocationnotfound ( place . name ) ;
189
191
[ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
190
192
} ) ;
191
193
} ) ;
194
+ $ ( inputBinding . locationNameInput )
195
+ . change ( function ( ) {
196
+ blur = true ;
197
+ } )
198
+ . blur ( function ( ) {
199
+ setTimeout ( function ( ) {
200
+ var address = $ ( inputBinding . locationNameInput ) . val ( ) ;
201
+ if ( address . length > 5 && blur ) {
202
+ blur = false ;
203
+ gmapContext . geodecoder . geocode ( { 'address' : address } , function ( results , status ) {
204
+ if ( status == google . maps . GeocoderStatus . OK ) {
205
+ GmUtility . setPosition ( gmapContext , results [ 0 ] . geometry . location , function ( context ) {
206
+ updateInputValues ( inputBinding , context ) ;
207
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
208
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
209
+ } ) ;
210
+ }
211
+ } ) ;
212
+ }
213
+ } , 1000 ) ;
214
+ } ) ;
192
215
}
193
216
if ( inputBinding . latitudeInput ) {
194
217
inputBinding . latitudeInput . on ( "change" , function ( ) {
You can’t perform that action at this time.
0 commit comments