adding zooming to maxDataExtent
This commit is contained in:
parent
8a1a2c834a
commit
30edb01ffc
|
@ -1,5 +1,4 @@
|
|||
var currentlySelectedFeature, jsonLayer, mapControl;
|
||||
|
||||
var map, currentlySelectedFeature, jsonLayer, mapControl, zoomControl;
|
||||
|
||||
// Simple JavaScript Templating
|
||||
// John Resig - http://ejohn.org/ - MIT Licensed
|
||||
|
@ -59,9 +58,12 @@ $(function() {
|
|||
map.addLayers(layers);
|
||||
map.setCenter(center, 12);
|
||||
|
||||
mapControl = new OpenLayers.Control.SelectFeature(layers[1], {hover: false});
|
||||
mapControl = new OpenLayers.Control.SelectFeature(layers[1], {hover: false});
|
||||
zoomControl = new OpenLayers.Control.ZoomToMaxExtent();
|
||||
map.addControl(mapControl);
|
||||
// map.addControl(zoomControl);
|
||||
mapControl.activate();
|
||||
// zoomControl.activate();
|
||||
layers[1].events.on({
|
||||
'featureselected': onFeatureSelect
|
||||
});
|
||||
|
@ -147,6 +149,9 @@ $(function() {
|
|||
var currFeatures = jsonLayer.features;
|
||||
jsonLayer.removeFeatures(currFeatures);
|
||||
jsonLayer.addFeatures(geojson_format.read(features));
|
||||
var maxExtent = jsonLayer.getDataExtent();
|
||||
map.zoomToExtent(maxExtent);
|
||||
// console.log(maxExtent);
|
||||
switch(type.toLowerCase()) {
|
||||
case "image":
|
||||
var html = tmpl("tmpl_images", {'images': json.images});
|
||||
|
|
Loading…
Reference in New Issue
Block a user