 class window.LeafletMap
   @CyclestreetsUrl: "https://www.cyclestreets.net"
   @default_marker_anchor: [30 / 2, 42]
-  @drawnItems: new L.FeatureGroup()
 
   constructor: (center, opts) ->
     @domId = opts.domid || 'map'


  drawFeatureId: (feature, id) =>
    if @drawnFeatures[id]
      @constructor.drawnItems.removeLayer @drawnFeatures[id]
      @drawnLayerChanged()
    if feature
      feature = L.geoJson(feature).getLayers()[0]

    $('.edit-undo').click (evt) ->
      evt.preventDefault()
      evt.stopPropagation()
      if @drawnItems.getLayers().slice(-1)[0]?.editing?._enabled
        @drawnItems.removeLayer(@drawnItems.getLayers()[-1..][0])
      else
        $('ul.leaflet-draw-actions a[title^="Delete"]')[0].click()

