1

First of all I would like to thank you all for amazing libraries like leaflet/leaflet.draw and leaflet.snap.

What I want to do is outside leaflet.draw control with supporting leaflet snap. This is nicely working with in side map draw control.

Below I show how did I call outside leaflet draw control:

<div><button id="draw_mark1" onclick="drawMarker1()" >Draw Marker1</button></div>
<div><button id="draw_polyline1" onclick="drawPolyline1()" >Draw Polyline1</button></div>

    function drawMarker1(){
        var markerDrawer1 = new L.Draw.MarkerA(map, { icon: new myIcon_xx() });     
        markerDrawer1.enable();
    }

    function drawPolyline1(){
        var polylineDrawer1 = new L.Draw.PolylineType1(map);     
        polylineDrawer1.enable();
    }

note:- leaflet.snap not in the tag list. I want to tag it too.

Ilya
  • 4,583
  • 4
  • 26
  • 51
  • Did you read http://stackoverflow.com/questions/15775103/leaflet-draw-mapping-how-to-initiate-the-draw-function-without-toolbar ? – YaFred Jul 04 '16 at 07:01
  • thank you for helping me..wait..i'l read and send the feedback.. .... – Buddhika Rajapakshe Jul 04 '16 at 07:55
  • i read it..but its working for me..how ever i did it using little hack..but not good for production site... in each html button click event ,i call my custom L.DrawToolbar.include with custom drawcontrol.. – Buddhika Rajapakshe Jul 04 '16 at 13:18
  • new L.Draw.Polyline(map, drawControl.options.polyline).enable(); can't call without defining drawcontrol.. & is this drawControl.options.polyline just for options? – Buddhika Rajapakshe Jul 04 '16 at 13:23

0 Answers0