views:

51

answers:

1

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 some methods?

A: 

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

Regards Teodoro

Teodoro Gomez LLanos