center map on stop when you click on it

This commit is contained in:
Sanj 2012-02-23 06:38:39 +05:30
parent 374a8f695f
commit 7c869fd4da

View File

@ -69,6 +69,8 @@ var API_BASE = "/1.0/",
var url = API_BASE + name + "/" + $target.find(".listItemText").text();
$target.data("loading", true);
var $loading = $('<span />').addClass("loadingSpan").text("Loading...").appendTo($target);
$('#stopForm').remove();
$('#formCol').empty();
$.getJSON(url, {'srid': 3857}, function(obj) {
$loading.remove();
var stopsGeojson = obj.stops;
@ -370,6 +372,9 @@ var API_BASE = "/1.0/",
$('.selectedStop').removeClass("selectedStop");
}
mapControl.select(feature);
//map.setCenter(feature.geometry);
var lonLat = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);
map.setCenter(lonLat);
}
//return currently selected feature or false