0

I have an ASP.NET page using a leaflet map. I have a filter being applied to some map icons. When I apply the filter, which is an ASPX control. when the result of the filter comes back, since ASP resends the entire page back to the client, i loose the current zoomed in region I was looking at.

I have saved off the values of the last bound coordinates the user was looking at but exclude the possibility of the most zoomed out case since that's what i'm trying to avoid. I'm trying something like

string temp = "<script language=\"Javascript\"> 
                 myMAP.fitBounds([[RA[0],RA[1}][RA[2],RA[3]]);  
              </script>";

Page.ClientScript.RegisterStartupScript(this.GetType(), "resetZoom", temp);

but I'm still seeing the map get reset like when the page gets sent back. am I calling the wrong leaflet method or is there a better way to implement what I'm trying to do? Please advise...

4

1 回答 1

0

.fitBounds()方法在点之间有一个昏迷,所以我会是这样的:

.fitBounds([
  [RA[0], RA[1]],
  [RA[2], RA[3]]
]);

来源

它解决了你的问题吗?

于 2013-10-26T18:15:31.950 回答