开发者

How to temporaily block map zoom using Bing Maps API?

开发者 https://www.devze.com 2023-01-04 20:44 出处:网络
I am using Bing Maps API and I have to temporaily block zoom. Plese tell me how to do that using Java Script? I relize that I have to block some key controls and remove + / - buttons from default Bing

I am using Bing Maps API and I have to temporaily block zoom. Plese tell me how to do that using Java Script? I relize that I have to block some key controls and remove + / - buttons from default Bing Map controls.

Edit; To hide controlls I can use VEMap.HideDashboard Method. But how to block response for some keys? Do I have to overload som开发者_高级运维e methods?


You could override the events on map like this:

var bloc_zoom = false;
var bloc_pan = false;


function PaintMap()
{
    var VEMap = new VEMap(MapDivId);
    VEMap.AttachEvent("ondoubleclick", block_zoom);
    VEMap.AttachEvent("onkeydown", block_zoom);
    VEMap.AttachEvent("onmousedown", block_pan);
    VEMap.AttachEvent("onmousewheel", block_zoom);
}

function block_zoom(e)
{
     if(block_zoom)
     {
         return true ;
     }
}

function block_pan(e)
{
     if(block_pan)
     {
         return true ;
     }
}

Just turn on the flag when you want to block sum and/or Pan

0

精彩评论

暂无评论...
验证码 换一张
取 消