From 1e51efa5bece896e2f60a9b43823fd9ccf41099d Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 5 Jul 2017 12:41:50 -0400 Subject: [PATCH] Add leaflet-draw tests --- types/leaflet-draw/leaflet-draw-tests.ts | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/types/leaflet-draw/leaflet-draw-tests.ts b/types/leaflet-draw/leaflet-draw-tests.ts index db6548d844..80e175732f 100644 --- a/types/leaflet-draw/leaflet-draw-tests.ts +++ b/types/leaflet-draw/leaflet-draw-tests.ts @@ -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: 'Oh snap! 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 + } + }); +}