The Virtual Earth map control supports several interactive ways to zoom in and out on the 2D map view.  For example, you can:

  • Click on (or click and hold) the zoom In/zoom Out icons on the navigation control.
  • Double-click on the map to zoom in at a particular point.
  • Hold down the "Alt" key and then click and drag on the mouse to create a zoom box which will become the next view.
  • Use the mouse wheel to zoom in and zoom out.

By default, when scrolling the mouse wheel up, it will zoom in on the center of the current view.  When scrolling the mouse wheel down, it will zoom out with the center of the view the center of the scene.

The Virtual Earth v5 and v6 API allow you to override many of the Virtual Earth events with the VEMap.AttachEvent call including many mouse events such as "onclick", "ondoubleclick", "onmousemove", "onmousedown", and "onmousewheel".  Your event handler can override the default Virtual Earth behavior by returning true from the handler.  If you return false from your event handler, your custom behavior and the default behavior will be executed.  For example, the following code snippet shows how to override "onmousedown" and "onmousewheel" for 2D in v6:

function EventMouseDown()
{
   //insert custom behavior here...
   //return true to disable the default behavior. return false to enable the default behavior.
   return true;
}


function EventMouseWheel()
{
   //insert custom behavior here...
   //return true to disable the default behavior. return false to enable the default behavior.
   return true;
}

map.AttachEvent("onmousedown", EventMouseDown);
map.AttachEvent("onmousewheel", EventMouseWheel);

Here's a link to a working example with checkboxes allowing you to turn off mouse down and mouse wheel events in 2D:

Virtual Earth API Event Customization Sample

The v6 also API added a simpler built-in approach to overriding the default mouse wheel zoom behavior. The default zoom in behavior for the mouse wheel is to zoom to the center of the map view. However, some users want the mouse wheel to zoom to the mouse cursor in the view.  To make this simple so you do not have to override "onmousewheel", we went ahead and added the SetMouseWheelZoomToCenter call to VEMap.  By default it is set to true so mouse wheel events will zoom to the center of the scene.  However, if you pass false to this function, the mouse wheel will zoom to the mouse cursor.

Here's a link to a working example with radio buttons allowing you to select mouse wheel "Zoom to Center" or "Zoom to Mouse" behavior in 2D:

Virtual Earth Mouse Wheel Zoom Sample