Schematic.prototype.connect =function(line,x,y){ var x1=line.getAttributeNS(null,"x1")-0; var x2=line.getAttributeNS(null,"x2")-0; var y1=line.getAttributeNS(null,"y1")-0; var y2=line.getAttributeNS(null,"y2")-0; this.remove(line); this.wireevents(this.createline('black',2,x1,y1,x,y)); this.wireevents(this.createline('black',2,x,y,x2,y2)); if($('templine1')){ x1=$('templine1').getAttributeNS(null,'x1'); y1=$('templine1').getAttributeNS(null,'y1'); x2=$('templine1').getAttributeNS(null,'x2'); y2=$('templine1').getAttributeNS(null,'y2'); var svg=this.createline('black',2, x1, y1,x2, y2); this.wireevents(svg); this.drawing.appendChild(svg) } if($("templine2")){ x1=$('templine2').getAttributeNS(null,'x1'); y1=$('templine2').getAttributeNS(null,'y1'); x2=$('templine2').getAttributeNS(null,'x2'); y2=$('templine2').getAttributeNS(null,'y2'); var svg=this.createline('black',2, x1, y1,x2, y2); this.wireevents(svg); this.drawing.appendChild(svg) } this.remove($("templine1")); this.remove($("templine2")); } /* Event.observe(circle,"mouseover",function(){ var data = $A(arguments); data.shift(); this.onconnector=true; if(this.mode=='line'){ var x=data[0].getAttribute("cx"); var y=data[0].getAttribute("cy"); var line1=$("templine1"); var line2=$("templine2") var l1x1=line1.getAttribute("x1"); var l1x2=line1.getAttribute("x2"); // var l2y2=line2.getAttribute("y2"); // horizontal x2 if(l1x1 != l1x2){ line1.setAttribute("x2",x); line2.setAttribute("x1",x); line2.setAttribute("x2",x); line2.setAttribute("y2",y); } else { line1.setAttribute("y2",y); line2.setAttribute("y1",y); line2.setAttribute("y2",y); line2.setAttribute("x2",x); } } data[0].setAttribute('visibility','visible'); }.bindAsEventListener(this,circle)); Event.observe(circle,"mouseout",function(){ this.onconnector=false; if(!this.connections){ var data = $A(arguments); data.shift(); data[0].setAttribute('visibility','hidden'); } }.bindAsEventListener(this,circle)); Event.observe(circle,"mousedown",function(){ var data = $A(arguments); data.shift(); if(this.mode=='select'){ parent.webtronics.setMode('line','Wire'); var svg = this.createline('blue',2, data[0], data[1], data[0], data[1]); svg.id = 'templine1'; svg.setAttributeNS(null,'stroke-dasharray','3,2'); this.info.appendChild(svg); } else{ this.wiresegment(); this.wiresegment(); this.remove($("templine1")); parent.webtronics.setMode('select','Selection'); } }.bindAsEventListener(this,parts[i].analogpins[j].x,parts[i].analogpins[j].y)); */ Schematic.prototype.maketerminal=function(wire){ var circle=this.createdot('red',0,0,5); circle.setAttribute("pointer-events","all"); circle.setAttributeNS(null, 'fill-opacity', .35); circle.setAttribute('visibility','hidden'); Event.observe(circle,"mouseout",function(){ var data = $A(arguments); data.shift(); this.onconnector=false; data[0].setAttribute('visibility','hidden'); }.bindAsEventListener(this,circle)); /*this makes sure dots are not shown when not moused over*/ Event.observe(circle,"mouseover",function(){ var data = $A(arguments); data.shift(); this.onconnector=true; if(this.mode=='line'){ var x=data[0].getAttribute("cx"); var y=data[0].getAttribute("cy"); var line1=$("templine1"); var line2=$("templine2") if(line1==null)return; var l1x1=line1.getAttribute("x1"); var l1x2=line1.getAttribute("x2"); //this locks the templine onto the dot // horizontal x2 if(l1x1 != l1x2){ line1.setAttribute("x2",x); if(line2){ line2.setAttribute("x1",x); line2.setAttribute("x2",x); line2.setAttribute("y2",y); } } else { line1.setAttribute("y2",y); if(line2){ line2.setAttribute("y1",y); line2.setAttribute("y2",y); line2.setAttribute("x2",x); } } } data[0].setAttribute('visibility','visible'); }.bindAsEventListener(this,circle)); Event.observe(circle,"mousedown",function(e){ var data = $A(arguments); data.shift(); var x=data[0].getAttribute("cx"); var y=data[0].getAttribute("cy"); var dots=$$("#webtronics_drawing > circle"); var found=false; /* for(var i=0;i .webtronics_schematic_wire_connector'); // for(var i=0;i g')); //this.connectnamewires(parts); for(var i=0 ;i line"); for(var i=0;i line" ); for(var i=0;i .webtronics_part_terminal') for(var i=0;i .webtronics_part_terminal') for(var i=0;i .webtronics_wire_terminal , #information > .webtronics_part_terminal,#information > .webtronics_schematic_wire_eventline ') for(var i=0;i