Hi Josh,
The extent is not automatically updated, we can add some logic to update it manually.
The following are the code snippets show how to update the server-side extent and client-side extent
===.cshtml===
@{Html.ThinkGeo().Map("Map1", new System.Web.UI.WebControls.Unit("100%"), 510)
.CurrentExtent(-125, 72, 50, -46)
.MapUnit(GeographyUnit.DecimalDegree)
// Adds ExtentedChanged event.
.OnClientExtentChanged("zoomToFeature")
.Render();
}
function extentChanged(e) {
var extent = Map1.getExtent();
var extentStr = extent.toString();
var extentStrextentStrArray = extentStr.split(",");
if (Map1.ajaxCallAction) {
// sent client extent to server-side
Map1.ajaxCallAction('@ViewContext.RouteData.Values["Controller"].ToString()', 'ExtentChanged', extentStrextentStrArray, callback);
}
}
function callback(result) {
// updae client-side extent.
var parameters = result.get_responseData().split("|");
var extent = parameters[0].split(",");
var bbox = new OpenLayers.Bounds(extent[0], extent[1], extent[2], extent[3]);
Map1.zoomToExtent(bbox);
}
=== Controller.cs===
[MapActionFilter]
public string ExtentChanged(Map map, GeoCollection<object> args)
{
var target = args[0].ToString();
double minX = double.Parse(args[0].ToString());
double maxY = double.Parse(args[3].ToString());
double maxX = double.Parse(args[2].ToString());
double minY = double.Parse(args[1].ToString());
map.CurrentExtent = new RectangleShape(minX, maxY, maxX, minY);
// sent extent to client-side
var extent = map.CurrentExtent;
string extentString = string.Format(CultureInfo.InvariantCulture, "{0},{1},{2},{3}", extent.LowerLeftPoint.X, extent.LowerLeftPoint.Y, extent.UpperRightPoint.X, extent.UpperRightPoint.Y);
return extentString;
}
Also you can refer to http://samples.thinkgeo.com/MvcEdition/HowDoISamples/ZoomingPanningMoving/ExtentChangedEvent/1,AllSamples
http://samples.thinkgeo.com/MvcEdition/HowDoISamples/SpatialFunctions/ZoomInToAFeatureClicked/1,FeaturedMvc
Hope this can help,
Thanks,
Emil