简体   繁体   中英

Can I limit users to a specific range and zoom level on Bing Maps?

Similar to Can I limit users to a specific range and zoom level on Google Maps? except with Bing Maps.

I don't see anything in the API for it specifically, so I'm not sure that it is easily done without overriding some method (and I don't know which one at that). I'm only working in javascript, not silverlight or any serverside technology.

It can be done, but they don't make it easy. You need to listen to the mouse move event.

function LimitMove(e)
  {
     if (/* is map inside valid bounds check */)
     {
         return true; //true means we will handle the event (do nothing)
     }
     return false; //false means let the map do the default action (move)
  }

map.AttachEvent("onmousemove", LimitMove);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM