 
   drawNode: (node, point) ->
       MARGIN = 10
-
       nodeView = view node.data
       ctx.font = "10pt Times"
       {width, height, count} = util.textSize ctx, nodeView

      click: (e) =>
        pos = $(canvas).offset()
        _mouseP = arbor.Point(e.pageX-pos.left, e.pageY-pos.top)
        object = particleSystem.nearest(_mouseP)

        if @nodeHitTest(object.node, _mouseP)
          objectHandler.selectedNode(object.node.name)
        else
          # click on an edge?
          particleSystem.eachEdge (edge, fromPoint, toPoint) =>
            if (@edgeHitTest(edge, _mouseP, 10))
              objectHandler.selectedEdge edge.data._neo_id
              return false

        false

    $(canvas)

    ctx.font = "10pt Times"
    ctx.fillStyle ='red'
    util.drawText(ctx, [edge.data.rel_type], x, y)

  pointToLineDist: (point, lineP1, lineP2) ->
    # See http://mathworld.wolfram.com/Point-LineDistance2-Dimensional.html
