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 171
171
} ) ;
172
172
}
173
173
if ( inputBinding . locationNameInput && gmapContext . settings . enableAutocomplete ) {
174
+ var blur = false ;
174
175
gmapContext . autocomplete = new google . maps . places . Autocomplete ( inputBinding . locationNameInput . get ( 0 ) ) ;
175
176
google . maps . event . addListener ( gmapContext . autocomplete , 'place_changed' , function ( ) {
177
+ blur = false ;
176
178
var place = gmapContext . autocomplete . getPlace ( ) ;
177
179
if ( ! place . geometry ) {
178
180
gmapContext . settings . onlocationnotfound ( place . name ) ;
184
186
[ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
185
187
} ) ;
186
188
} ) ;
189
+ $ ( inputBinding . locationNameInput )
190
+ . change ( function ( ) {
191
+ blur = true ;
192
+ } )
193
+ . blur ( function ( ) {
194
+ setTimeout ( function ( ) {
195
+ var address = $ ( inputBinding . locationNameInput ) . val ( ) ;
196
+ if ( address . length > 5 && blur ) {
197
+ blur = false ;
198
+ gmapContext . geodecoder . geocode ( { 'address' : address } , function ( results , status ) {
199
+ if ( status == google . maps . GeocoderStatus . OK ) {
200
+ GmUtility . setPosition ( gmapContext , results [ 0 ] . geometry . location , function ( context ) {
201
+ updateInputValues ( inputBinding , context ) ;
202
+ context . settings . onchanged . apply ( gmapContext . domContainer ,
203
+ [ GmUtility . locationFromLatLng ( context . location ) , context . radius , false ] ) ;
204
+ } ) ;
205
+ }
206
+ } ) ;
207
+ }
208
+ } , 1000 ) ;
209
+ } ) ;
187
210
}
188
211
if ( inputBinding . latitudeInput ) {
189
212
inputBinding . latitudeInput . on ( "change" , function ( ) {
You can’t perform that action at this time.
0 commit comments