GitHub – Leaflet/Leaflet.draw: Vector drawing and editing plugin for Leaflet

Leaflet.draw 0.2.0 changes a LOT of things from 0.1. Please see BREAKING CHANGES for how to upgrade. To install the plugin run npm install leaflet-draw via command line in your project. You must also require this in your project like so: var leaflet-draw = require('leaflet-draw'), The default state for the control is the draw toolbar just below the zoom control. This will allow map users to draw vectors and markers. Please note the edit toolbar is not enabled by default. To use the edit toolbar you must initialise the Leaflet.draw control and manually add it to the map. The key here is the featureGroup option. This tells the plugin which FeatureGroup contains the layers that should be editable. Once you have successfully added the Leaflet.draw plugin to your map you will want to respond to the different actions users can initiate. The following events will be triggered on the map: Note: To maintain the original layer color of the layer use maintainColor: true within selectedPathOptions. Leaflet.draw uses the L.drawLocal configuration object to set any text used in the plugin. Customizing this will allow support for changing the text or supporting another language. If you do not want a particular toolbar in your app you can turn it off by setting the toolbar to false. If you want to turn off a particular toolbar item, set it to false. The following disables drawing polygons and markers. It also turns off the ability to edit layers. You can change a draw handlers options after initialisation by using the setDrawingOptions method on the Leaflet.draw control. If you only require certain handlers (and not the UI), you may wish to create a custom build. You can generate the relevant jake command using the build html file. Touch friendly version of Leaflet.draw was created and maintained by Michael Guild (https://github.com/michaelguild13). The touch support was initiated due to a demand for it at National Geographic for their Map Maker Projected (http://mapmaker.education.nationalgeographic.com/) that was created by Michael Guild and Daniel Schep (https://github.com/dschep) Thanks so much to @brunob, @tnightingale, and @shramov. I got a lot of ideas from their Leaflet plugins. All the contributors and issue reporters of this plugin rock. Thanks for tidying up my mess and keeping the plugin on track. The icons used for some of the toolbar buttons are either from http://glyphicons.com/ or inspired by them. <,3 Glyphicons! Finally, @mourner is the man! Thanks for dedicating so much of your time to create the gosh darn best JavaScript mapping library around. Source.


Яндекс.Метрика Рейтинг@Mail.ru Free Web Counter
page counter
Last Modified: April 25, 2016 @ 1:08 pm