 
   constructor: (@$scope, @$modalInstance, @snippet, @leafletData, @$timeout, @leafletEvents) ->
     @$scope.close = $.proxy(@close, this)
+    @$scope.addMarker = $.proxy(@addMarker, this)
     @$scope.center = @snippet.data('center')
     @$scope.markers = @snippet.data('markers')
     @$scope.editState = {}
 
-    @$scope.events =
-      map:
-        enable: @leafletEvents.getAvailableMapEvents()
+    @addGeosearch()
+    @setupMapEvents()
 
+
+  addGeosearch: ->
     @$timeout =>
       @leafletData.getMap().then (map) =>
         new L.Control.GeoSearch(

        bottom: args.leafletEvent.originalEvent.clientY
        left: args.leafletEvent.originalEvent.clientX - 7
        width: 0


  close: (event) ->

        ).addTo(map)
    , 100


  setupMapEvents: ->
    @$scope.events =
      map:
        enable: ['click']
      markers:
        enable: ['click']

    @$scope.$on 'leafletDirectiveMap.click', (e, args) =>
      @$scope.editState.addMarker = true
      @$scope.editState.boundingBox =
