DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Draggable EInsert

08.24.2006
| 3975 views |
  • submit to reddit
        // description of your code here

<script type="text/javascript">
    //<![CDATA[
    
    if (GBrowserIsCompatible()) { 

      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(53.849, -3.022),16);

      // Optionally set the cursors to be used for dragging
      GDraggableObject.setDraggableCursor("move");


      // Insert the "Nosuch Road" road 
      var insert1 = new EInsert(new GLatLng(53.85022, -3.01772), "nosuch.png", new GSize(145,233), 16);
      map.addOverlay(insert1);
      // Make it draggable
      insert1.makeDraggable();
      
      // A new event that returns the new latlng when the drag ends
      GEvent.addListener(insert1, "dragend", function (pt) {
        GLog.write("New position of insert = "+ pt.lat() + ","+pt.lng());
      });

    }

    //]]>
    </script>