Export (0) Print
Expand All

VEShape.onenddrag Event

You are not viewing the latest version of the AJAX control. Bing Maps AJAX V7 is the recommended JavaScript control for Bing Maps. If you need this documentation, it is available in as a CHM or PDF download.

Occurs when a shape drag has stopped.

VEShape.onenddrag = function_name;

A ShapeDragEventArgs object, which has the following properties:

Property Description

Shape

The VEShape object that fired the event.

LatLong

The current VELatLong of the shape.

The onenddrag event occurs when the left mouse button up event occurs after a shape has been dragged.

The onenddrag event only occurs after the VEShape.onstartdrag Event has occurred.

For the onenddrag event to occur, the VEShape.Draggable Property must be set to true.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>Shape Dragging Sample</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>

      <script type="text/javascript">
         
         var map     = null;
         var pushpin   = null;

         
         function GetMap()
         {
            map = new VEMap('myMap');
            map.LoadMap();
           
            // Create the pushpin
            pushpin = new VEShape(VEShapeType.Pushpin, map.GetCenter());
            
            // Allow the pushpin to be dragged
            pushpin.Draggable = true;

            // Assign the shape drag event handlers
            pushpin.onstartdrag = StartDragHandler;
            pushpin.ondrag = DragHandler;
            pushpin.onenddrag = EndDragHandler;

            // Show an info box to indicate the pushpin can be dragged.
            pushpin.SetTitle("Drag me!");
            map.AddShape(pushpin);
            map.ShowInfoBox(pushpin);

         }

         function StartDragHandler(e)
         {
            document.getElementById("txtDragStatus").value = "Pushpin drag has started.";
         }

         function DragHandler(e)
         {
            document.getElementById("txtDragStatus").value = "Pushpin drag is occurring.";
         }

         function EndDragHandler(e)
         {
            document.getElementById("txtDragStatus").value = "Pushpin drag has ended.";
         }

      </script>
   </head>
   <body onload="GetMap();">
      <div id='myMap' style="position:relative; width:600px; height:400px;"></div>
      <input id="txtDragStatus"/>      
   </body>
</html>

Show:
© 2014 Microsoft