OpenLayers OpenLayers

Changeset 6969

Show
Ignore:
Timestamp:
04/18/08 20:13:53 (9 months ago)
Author:
tschaub
Message:

properly bind callback to control

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/topp/almanac/lib/OpenLayers/Control/Geocoder.js

    r6953 r6969  
    5050            } 
    5151        } 
     52         
     53        var bound = OpenLayers.Function.bind(function(point) { 
     54            if(point){ 
     55                var lonlat = new OpenLayers.LonLat(point.lng(), point.lat());             
     56                lonlat.transform( 
     57                    new OpenLayers.Projection("EPSG:4326"), 
     58                    new OpenLayers.Projection(this.map.projection) 
     59                ); 
     60                callback(lonlat); 
     61            } 
     62        }, this); 
    5263 
    53         this.geocoder.getLatLng( 
    54             address, 
    55             function(point) { 
    56                 if(point){ 
    57                     var lonlat = new OpenLayers.LonLat(point.lng(), point.lat());             
    58                     lonlat.transform( 
    59                         new OpenLayers.Projection("EPSG:4326"), 
    60                         new OpenLayers.Projection(this.map.projection) 
    61                     ); 
    62                     callback(lonlat); 
    63                 } 
    64             } 
    65         ); 
     64        this.geocoder.getLatLng(address, bound); 
    6665    }, 
    6766