 	constructor: (@paper) ->
 		@paper.clear()
 		@rectangleWidth = 100
+		@rectangleMaxWidth = 100
 		@rectangleHeight = 50
 		@childrenVerticalPadding = 40
 		@childrenHorizontalPadding = 20

			b = @findNodeInTree bname, tree;

			# do we need to add the parent block to the tree?
			if !a
				a = {name: aname, colour: "", children:[]}
				tree.children.push a

			# don't panic about self loops
			continue if aname == bname


		return {rectangle:newRect, svg:actualRect}

	drawText: (x, y, content) ->
		maxWidth = @rectangleWidth
		t = @paper.text(x, y).attr(
			{"font-size": "13px", 
			"font-family":"'Shadows Into Light Two', sans-serif",
			"text-anchor": "center"
			})

		# thanks stack overflow
		words = content.split(" ")
		tempText = ""
		for word in words
			t.attr("text", tempText + " " + word)
			if (t.getBBox().width > maxWidth) 
				tempText += "\n" + word
			else 
				tempText += " " + word

		t.attr("text", tempText.substring(1))
		  
		

	drawAndConnectToBlock:(previousBlock, block, childIndex, direction, arrow) ->
		previousRectangle = previousBlock.rectangle # block also contains the svg, just in case
