Skip to content

Releases: StratoDem/SDLeafletDraw

v1.2.0

11 Mar 20:54
Compare
Choose a tag to compare

Bugfixes for Delete, Edit and Feature components

v1.1.0

11 Mar 20:23
Compare
Choose a tag to compare
  • Update requirements for Leaflet 1.3.1
  • Fix for this._tooltip is null in Marker class with:
const Feature = BaseFeature.include(L.Evented.prototype);

Initial sdleafletdraw release

05 Jul 21:17
Compare
Choose a tag to compare

Initial sdleafletdraw release with ES6+Flow+Babel.
To use:

$ npm install [email protected]
import L from 'leaflet';
import 'sdleafletdraw';
// Include the css files
import 'sdleafletdraw/dist/leaflet.draw.css';

const map = new L.Map('map');
const editableLayers = new L.FeatureGroup();
map.addLayer(editableLayers);

const drawControl = new L.Control.Draw({
    draw: {
        polyline: false,
        circle: false,
        marker: false,
        rectangle: {
            color: 'red',
            fillOpacity: 0.1,
            opacity: 1,
            weight: 4,
        },
        polygon: {
            color: 'blue',
            fillOpacity: 0.1,
            opacity: 0.8,
            weight: 2.5,
        },
    },
    position: 'topleft',
    allowIntersection: false,
    edit: {
        featureGroup: editableLayers,  // A leaflet featureGroup
    }
});
map.addControl(drawControl);

map.on(L.Draw.Event.CREATED, (event) => {
    const { layerType, layer } = event;

    if (layerType === 'marker')
        layer.bindPopup('A popup!');

    editableLayers.addLayer(layer);
});