Leaflet doodle
by garnwraly
HTML
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js?2"></script>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css">
<div id="map"></div>
<button id="removeDraw">Remove draw control</button>
CSS
#map {
height: 340px;
}
JavaScript
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png', {
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>',
maxZoom: 18
}).addTo(map);
var drawnItems = new L.FeatureGroup();
map.addLayer(drawnItems);
var drawControl = new L.Control.Draw({
draw: {
position: 'topleft',
circle: false,
rectangle: false,
marker: false,
polyline: false
},
edit: false
});
map.addControl(drawControl);
L.DomUtil.get('removeDraw').onclick = function () {
map.removeControl(drawControl);
};