     setStyle(ctx, node_style)
     ctx.beginPath()
     renderShape(ctx, @shape, default_node_radius)
-    ctx.stroke()
-    ctx.restore()
-
-  mousedown: (pos) ->
+
+    if @dropdown_menu?
+      ctx.fillStyle = ctx.strokeStyle
+      ctx.fill()
+      ctx.restore()
+
+      ctx.textAlign = 'start'
+      ctx.textBaseline = 'top'
+
+      for option, i in @dropdown_menu.options
+        setStyle(ctx, menu_text_style)
+        measure = ctx.measureText(option.name)
+        ctx.fillStyle= if @dropdown_menu.selected == i then 'white' else 'black'
+        ctx.fillRect(
+          @dropdown_menu.pos.x,
+          @dropdown_menu.pos.y + menu_text_height * (i+1),
+          measure.width,
+          menu_text_height)
+
+        setStyle(ctx, if @dropdown_menu.selected == i
+            menu_text_invert_style
+          else
+            menu_text_style)
+
+        ctx.fillText(option.name,
+          @dropdown_menu.pos.x,
+          @dropdown_menu.pos.y + menu_text_height * (i+1))
+    else
+      ctx.stroke()
+      ctx.restore()
+
+
+  mousedown: (pos, idx) ->
     for n in @nodes
       if n.isHit(pos)
         if @merging?


    fn(this)

class NodeCollection
  constructor: (@shape) ->
    @nodes = []

          t: Date.now()
        return true

    if @isHandleHit(pos, idx)
      @dropdown_menu = {
        pos: pos
        options: collection_dropdown_menu
        selected: -1
      }
    return false

  isHandleHit: (pos, idx) ->
    dx = pos.x - default_node_radius*2
    dy = pos.y - default_node_radius*(2 + 3 * idx)

    return dx*dx + dy*dy < default_node_radius*default_node_radius

  mousemove: (pos) ->
    if @dropdown_menu?
      @dropdown_menu.selected = -1
      for option, i in @dropdown_menu.options
        if pos.x > @dropdown_menu.pos.x and
           pos.y >= @dropdown_menu.pos.y + menu_text_height * (i+1) and
           pos.y <  @dropdown_menu.pos.y + menu_text_height * (i+2)
          @dropdown_menu.selected = i
      return

    if @selected?
      s = @selected
      dx = (pos.x - s.mx + s.ox) - s.node.x
