 
     if latLng
       @updateContent labelText
-      @__updatePosition latLng
-
-    return
-
-  __updatePosition: (latlng) ->
+      @__updatePosition latLng, options
+
+    return
+
+  __updatePosition: (latlng, options = {}) ->
     pos = @_map.latLngToLayerPoint(latlng)
     labelWidth = @_container.offsetWidth
 
     if @_container
       pos = pos.add(L.point(-labelWidth/2, 0))
       @_container.style.visibility = 'inherit'
+      container = @_map.layerPointToContainerPoint pos
+
+      if (container.x < 0 || container.y < @_container.offsetHeight) and options.target?
+        pos = @_map.latLngToLayerPoint(options.target)
+        L.DomUtil.removeClass(@_container, 'leaflet-draw-tooltip-top')
+
       L.DomUtil.setPosition(@_container, pos)
 
 

  __addHooks: L.Edit.Poly.prototype.addHooks
  __removeHooks: L.Edit.Poly.prototype.removeHooks

  __onHandlerDrag: ->
    center = @_poly.__getCenter()

    g = new L.GeographicUtil.Polygon @_poly.getLatLngsAsArray()

    measure =
      perimeter: g.perimeter()
      area: g.area()


    L.extend(L.Draw.Polyline.prototype.options, target: e.marker.getLatLng())

    @__tooltipMeasure.__updateTooltipMeasure center, measure, L.Draw.Polyline.prototype.options

