Add leaflet-draw tests

This commit is contained in:
Denis
2017-07-05 12:41:50 -04:00
parent ab4871f427
commit 1e51efa5be
+48
View File
@@ -69,3 +69,51 @@ function testBooleanControlOptions() {
}
});
}
function testExampleControlOptions() {
const editableLayers = new L.FeatureGroup([]);
map.addLayer(editableLayers);
const MyCustomMarker = L.Icon.extend({
options: {
shadowUrl: null,
iconAnchor: new L.Point(12, 12),
iconSize: new L.Point(24, 24),
iconUrl: 'link/to/image.png'
}
});
const drawControl = new L.Control.Draw({
position: 'topright',
draw: {
polyline: {
shapeOptions: {
color: '#f357a1',
weight: 10
}
},
polygon: {
allowIntersection: false, // Restricts shapes to simple polygons
drawError: {
color: '#e1e100', // Color the shape will turn when intersects
message: '<strong>Oh snap!<strong> you can\'t draw that!' // Message that will show when intersect
},
shapeOptions: {
color: '#bada55'
}
},
circle: false, // Turns off this drawing tool
rectangle: {
shapeOptions: {
clickable: false
}
},
marker: {
icon: new MyCustomMarker()
}
},
edit: {
featureGroup: editableLayers, // REQUIRED!!
remove: false
}
});
}