diff options
author | Patrick Simianer <p@simianer.de> | 2010-05-22 01:13:22 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2010-05-22 01:13:22 +0200 |
commit | 8f7153eb3867048ab90d35cbc075071bced993f0 (patch) | |
tree | 1419e54848129aa2c766ade1028b6dc3a00734e9 /javascripts/Graph.js | |
parent | 8c183055faf4d79c3c704170bd0d22fffe2795b3 (diff) |
almost done
Diffstat (limited to 'javascripts/Graph.js')
-rw-r--r-- | javascripts/Graph.js | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/javascripts/Graph.js b/javascripts/Graph.js deleted file mode 100644 index c2f350d..0000000 --- a/javascripts/Graph.js +++ /dev/null @@ -1,60 +0,0 @@ -//alert(ttable) - -Object.size = function(obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) size++; - } - return size; -}; - - - -function drawGraph() { - document.write('<pre>') - for (var state in ttable) { - document.write(state+' --><br />') - for (var i=0; i < ALPHABET.length; i++) { - if(ttable[state][ALPHABET[i]]) { - document.write('\t'+ALPHABET[i]+': ') - document.write(ttable[state][ALPHABET[i]]+'<br />'); - } - } - } - document.write('</pre>'); - - - - var dragger = function () { - this.ox = this.type == "rect" ? this.attr("x") : this.attr("cx"); - this.oy = this.type == "rect" ? this.attr("y") : this.attr("cy"); - this.animate({"fill-opacity": .2}, 500); - }, - move = function (dx, dy) { - var att = this.type == "rect" ? {x: this.ox + dx, y: this.oy + dy} : {cx: this.ox + dx, cy: this.oy + dy}; - this.attr(att); - for (var i = connections.length; i--;) { - r.connection(connections[i]); - } - r.safari(); - }, - up = function () { - this.animate({"fill-opacity": 0}, 500); - }, - r = Raphael("holder", 640, 480), - connections = [], - shapes = [ r.ellipse(190, 100, 30, 20), - r.rect(290, 80, 60, 40, 10), - r.rect(290, 180, 60, 40, 2), - r.ellipse(450, 100, 20, 20) - ]; - for (var i = 0, ii = shapes.length; i < ii; i++) { - var color = Raphael.getColor(); - shapes[i].attr({fill: color, stroke: color, "fill-opacity": 0, "stroke-width": 2, cursor: "move"}); - shapes[i].drag(move, dragger, up); - } - connections.push(r.connection(shapes[0], shapes[1], "#000")); - connections.push(r.connection(shapes[1], shapes[2], "#000", "#ccc")); - connections.push(r.connection(shapes[1], shapes[3], "#000", "#ccc")); -} - |