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

About this user

Nicolas Haase

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Draggable eInsert

// description of your code here

   1  
   2  <script type="text/javascript">
   3      //<![CDATA[
   4      
   5      if (GBrowserIsCompatible()) { 
   6  
   7        var map = new GMap2(document.getElementById("map"));
   8        map.addControl(new GLargeMapControl());
   9        map.addControl(new GMapTypeControl());
  10        map.setCenter(new GLatLng(53.849, -3.022),16);
  11  
  12        // Optionally set the cursors to be used for dragging
  13        GDraggableObject.setDraggableCursor("move");
  14  
  15  
  16        // Insert the "Nosuch Road" road 
  17        var insert1 = new EInsert(new GLatLng(53.85022, -3.01772), "nosuch.png", new GSize(145,233), 16);
  18        map.addOverlay(insert1);
  19        // Make it draggable
  20        insert1.makeDraggable();
  21        
  22        // A new event that returns the new latlng when the drag ends
  23        GEvent.addListener(insert1, "dragend", function (pt) {
  24          GLog.write("New position of insert = "+ pt.lat() + ","+pt.lng());
  25        });
  26  
  27      }
  28  
  29      //]]>
  30      </script>
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS