   
   constructor: ->
     super
-    svgns = 'http://www.w3.org/2000/svg'
+    
+    # Create SVG elements
+    @gCross  = @initCross()
+    @gRemove = @initRemove()
     
     # Create the root SVG group
-    gRoot = document.createElementNS(svgns, "g")
-    gRoot.setAttribute("transform", "translate(#{@x}, #{@y})")
+    @gRoot = document.createElementNS(@svgns, "g")
+    @gRoot.setAttribute("transform", "translate(#{@x}, #{@y})")
+    
+    # Append elements to root group
+    @gRoot.appendChild(@gCross)
+    @gRoot.appendChild(@gRemove)
+    
+    # Append SVG to DOM
+    @el[0].appendChild(@gRoot)
+    
+    # Set control parameters
+    @drag = false
+    @hasDragged = false
+    @isRemoveVisible = false
+    
+    # Bind mouse events
+    @el.bind('mousemove', @onmousemoveEl)
+    @el.bind('mouseenter', @onmouseenterEl)
+    
+    @gRoot.onmousedown  = @onmousedown
+    @gRoot.onmouseup    = @onmouseup
+    @gRoot.onclick      = @onclick
+    @gRemove.onclick    = @remove
+  
+  initCross: =>
     
     # Create the crosshair SVG group
-    gCross = document.createElementNS(svgns, "g")
+    gCross = document.createElementNS(@svgns, "g")
     gCross.setAttribute("stroke", @color)
     gCross.setAttribute("stroke-width", 2)
     gCross.setAttribute("fill-opacity", 0)
     gCross.setAttribute("cursor", "move")
     
     # Create an SVG circle
-    c = document.createElementNS(svgns, "circle")
+    c = document.createElementNS(@svgns, "circle")
     c.setAttribute("r", @radius)
     
     # Create the crosshair
-    l1 = document.createElementNS(svgns, "line")
-    l2 = document.createElementNS(svgns, "line")
-    l3 = document.createElementNS(svgns, "line")
-    l4 = document.createElementNS(svgns, "line")
+    l1 = document.createElementNS(@svgns, "line")
+    l2 = document.createElementNS(@svgns, "line")
+    l3 = document.createElementNS(@svgns, "line")
+    l4 = document.createElementNS(@svgns, "line")
     
     l1.setAttribute("x1", @p1)
     l1.setAttribute("y1", 0)

    gCross.appendChild(l3)
    gCross.appendChild(l4)
    
    # Create the remove SVG group
    gRemove = document.createElementNS(svgns, "g")
    gRemove.setAttribute("transform", "translate(-#{@p2}, -#{@p2})")
    gRemove.setAttribute("cursor", "pointer")
    gRemove.setAttribute("visibility", "hidden")
    
    # Create an SVG circle
    cRemove = document.createElementNS(svgns, "circle")
    cRemove.setAttribute("r", @p1)
    cRemove.setAttribute("fill", "#FAFAFA")
    
    # Create an SVG text element
    tRemove = document.createElementNS(svgns, "text")
    tRemove.textContent = "x"
    tRemove.setAttribute("font-size", 11)
    tRemove.setAttribute("font-weight", 700)

  
  onmouseenterEl: (e) =>
    e.preventDefault()
    if @drag
      @onmouseup(e)
      
  
  onmousedown: (e) =>
    e.preventDefault()
