mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Add leaflet-draw tests
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user