     _create_point = (x,y) ->
       snapped = _snap_to_grid(x,y)
       unless scope.findPoint(snapped.x, snapped.y)  
-        _register_actions scope.addPoint paper.circle(snapped.x, snapped.y, 5).attr({fill: '#ff0000', stroke: 'none'})
+        scope.points_lines.push(pt = paper.circle(snapped.x, snapped.y, 5).attr({fill: '#ff0000', stroke: 'none'}))
+        _register_actions scope.addPoint pt
 
     _start_line = (x,y) ->
       snapped       = _snap_to_grid(x, y)
-      _current_line = new Line(snapped.x, snapped.y, paper)
+      _current_line = new Line(snapped.x, snapped.y, paper, scope.points_lines)
       _current_line.p2.click (e) ->
         xy = _get_x_y e
         _end_line(xy.x, xy.y)

        'default'

class Line 
  constructor: (startx, starty, @paper) ->
    @p1 = @paper.circle(startx, starty, 5).attr({fill: '#ff0000', stroke: 'none'})
    @p2 = @paper.circle(startx+6, starty+6, 5).attr({fill: '#ff0000', stroke: 'none'})
    @updatePath()
    _by_id = []
    _by_id[@p1.id] = @p1


    $scope.reset = ->
      $scope.resetting = true
      _.each $scope.points, (p) -> if (p? and p.id) then $scope.removePoint(p.id).remove()
      $scope.resetting = false
      $timeout -> 
        _update()
        $scope.points_lines.forEach (e) ->
          e.remove()
        $scope.points_lines.clear()

    $scope.$watch 'settings', () ->
      $scope.reset()
