Never been to DZone Snippets before?

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

Draggable eInsert (See related posts)

// 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>

You need to create an account or log in to post comments to this site.


Click here to browse all 4858 code snippets

Related Posts