       lc.setShapesInProgress(@_getShapes(lc))
       lc.repaintLayer('main')
 
+    polygonFinishOpen = () =>
+      @maybePoint = {x: Infinity, y: Infinity}
+      @_close(lc)
+
+    polygonFinishClosed = () =>
+      @maybePoint = @points[0]
+      @_close(lc)
+
+    polygonCancel = () =>
+      @_cancel(lc)
+
     unsubscribeFuncs.push lc.on 'drawingChange', => @_cancel(lc)
     unsubscribeFuncs.push lc.on 'lc-pointerdown', onDown
     unsubscribeFuncs.push lc.on 'lc-pointerdrag', onMove
     unsubscribeFuncs.push lc.on 'lc-pointermove', onMove
     unsubscribeFuncs.push lc.on 'lc-pointerup', onUp
+
+    unsubscribeFuncs.push lc.on 'lc-polygon-finishopen', polygonFinishOpen
+    unsubscribeFuncs.push lc.on 'lc-polygon-finishclosed', polygonFinishClosed
+    unsubscribeFuncs.push lc.on 'lc-polygon-cancel', polygonCancel
 
   willBecomeInactive: (lc) ->
     @_cancel(lc) if @points or @maybePoint

      @_getArePointsClose(@points[@points.length - 1], @maybePoint))

  _cancel: (lc) ->
    @_ensureFinishButtonsDontExist(lc)
    @maybePoint = null
    @points = null
    lc.setShapesInProgress([])
    lc.repaintLayer('main')

  _close: (lc) ->
    @_ensureFinishButtonsDontExist(lc)
    lc.setShapesInProgress([])
    lc.saveShape(@_getShape(lc, false)) if @points.length > 2
    @maybePoint = null


    onUp = =>
      return @_close(lc) if @_getWillFinish()
      lc.trigger 'lc-polygon-started'

      if @points
        @points.push(@maybePoint)
