     # Decision points will definitely be drawn.
 
     chainCount = 0
+    hasActiveNode = false
 
     # skip comment check on first node
     if tree.children.length == 1


  drawChainWithChainIndicatorFromTo : (top, middle, tree, decision) ->

    hasActiveNode = @chainContainsActiveNode(tree, decision.node)

    # Draw root, chain indicator and decision point
    @addNode(middle, top, tree.id)
    @drawEdge(middle, top, middle, top + 0.5 * @nodeDistance)
    @drawChainIndicator(middle, top + 0.5 * @nodeDistance, top + 1.5 * @nodeDistance, hasActiveNode)
    @drawEdge(middle, top + 1.5 * @nodeDistance, middle, top + 2 * @nodeDistance)
    @addNode(middle, top + 2 * @nodeDistance, decision.node.id)


        chainCount++

    while tree.children.length == 1 and !@nodeIdHasComment(tree.id)
      if !hasActiveNode
          hasActiveNode = tree.id == @activeNodeId
      tree = tree.children[0]
      chainCount++

