locked
How can I Disable or Cancel the onstartpan event? RRS feed

  • Question

  • Hi everyone: How can I Disable or Cancel the onstartpan event?

    I need to support a click-and-drag interface for drawing on the map when in a "Draw" mode, as opposed to the default "Pan" mode.

    I don't mind if the solution is unsupported, please let me know what direction to look in.

    THANKS in advance!!!

    -Dan!
    Tuesday, April 8, 2008 1:56 PM

Answers

  • The
    Code Snippet

    following will keep the map from panning when you use the leftmousebutton to drag on the map. Usually when I set my drawing functions to use the right mouse button that way I still have the ability to pan the map.


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
       <head>
          <title></title>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6"></script>
          <script>
        var map = null;
                   
         function GetMap()
         {
              map = new VEMap('myMap');
              map.LoadMap();
              map.AttachEvent('onmousedown',drag);
         }
         
         function drag(e)
         {
            if(e.leftMouseButton)
            {
               
                return true;
            }
         }
    </script>
    </head>
       <body onload="GetMap();">
          <div align="left" id='myMap' style="position:relative; width:600px; height:400px;"></div>
       </body>
    </html>

    Tuesday, April 8, 2008 3:35 PM
    Moderator