Multimap API v1.1 Example

Disabling Dragging Examples

Although the ability to drag maps with a mouse is a core feature of the Multimap API, there are times when you may not wish this to occur. The API provides a pair of methods to allow you to enable or disable dragging and to check the current status of dragging. These are setDraggable() and getDraggable().

What You Should See

If you view this in your browser you should see a Multimap draggable map displaying aerial photography centered on Fleet Street, London, Great Britain, at zoom factor 15.

A checkbox is offered to the right of the map; clearing this checkbox stops the map from being draggable. Checking the checkbox allows dragging again.

The Map

Is Map Draggable?

The Code

There are three parts to the code below. The first is the line that links to the Multimap API. The second is an example of the HTML you must have in your page. The third is an example of the JavaScript required to implement the page.

The header code


<script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/demo"></script>

The body code


<!-- The Multimap Map -->
<div id="mapviewer" style="width : 500px; height : 420px;"></div>

<!-- The Map Control -->
<form action="#" onsubmit="return false" method="get">
     <input type="checkbox" value="1" onclick="mapviewer.setDraggable( this.checked )" id="draggable" checked="yes"> Is Map Draggable?
</form>

The JavaScript code


var mapviewer;
        
function onLoad()
{
     //Add the map 
     mapviewer = new MultimapViewer( document.getElementById( 'mapviewer' ) );
     mapviewer.drawAndPositionMap( new MMLocation( new MMLatLon( 51.5145, -0.1085 ), 15 ) );
     // Firefox will remember the checkbox value between reloads,
     // so we need to check its current value
     mapviewer.setDraggable( document.getElementById( 'draggable' ).checked );
}

MMAttachEvent( window, 'load', onLoad );

For more information on the subject of Multimap API JavaScript code, please read the API documentation at: http://www.multimap.com/share/mapviewerapidocs/1.1/index.html.

Further Help

If you require further help with your map API implementation, please contact our Customer Support team:

Australia, Sydney + 61 (0) 2 9262 6551
Great Britain, London +44 (0)20 7632 7777
United States, Boston + 1 617 423 4510
email: info@multimap.com

For general account enquiries or further services, please contact your Multimap Sales team:

Australia, Sydney + 61 (0) 2 9262 6551
Great Britain, London +44 (0)20 7632 7800
United States, Boston + 1 617 423 4510
email: sales@multimap.com