 				d3.select(this).attr 'transform', '' # unenlarge target node
 
 			.on 'mousedown', (node) ->
+				# select node
+				mouseDownNode = node
+				if mouseDownNode == selectedNode
+					selectedNode = null
+				else
+					selectedNode = mouseDownNode
+
 				# reposition drag line
 				drag_line.style('marker-end', 'url(#endArrow)').classed('hidden', false).attr('d', 'M' + mouseDownNode.x + ',' + mouseDownNode.y + 'L' + mouseDownNode.x + ',' + mouseDownNode.y)
 				restart()

		nodes = svg.append('svg:g').selectAll('g')

		# mouse event vars
		mouseDownEdge = null
		mouseDownNode = null
		mouseUpNode = null

						net.addEdge(edge)
						$scope.$apply() # Quick save net to storage

				selectedNode = null
				restart()

			# show node text
