|
From: <ma...@us...> - 2011-01-14 22:39:28
|
Revision: 247
http://openautomation.svn.sourceforge.net/openautomation/?rev=247&view=rev
Author: mayerch
Date: 2011-01-14 22:39:21 +0000 (Fri, 14 Jan 2011)
Log Message:
-----------
Simplify connection when connected bock gets moved and the points get aligned.
Modified Paths:
--------------
PyWireGate/trunk/logic_editor/gle/gle.connection.js
Modified: PyWireGate/trunk/logic_editor/gle/gle.connection.js
===================================================================
--- PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-14 20:52:51 UTC (rev 246)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-14 22:39:21 UTC (rev 247)
@@ -181,13 +181,24 @@
this.firstMove = function( pos )
{
- if( paths[0].path[0][1] == paths[0].path[1][1] ) // keep horizontal line
+ if( Math.abs( paths[0].path[0][1] - paths[0].path[1][1] ) < 1.0 ) // keep horizontal line
{
paths[0].path[0] = pos;
paths[0].path[1][1] = pos[1];
} else {
paths[0].path[0] = pos;
}
+ // remove obsolete points if the are the same now
+ if( paths[0].path.length > 3 &&
+ Math.abs( paths[0].path[1][0] - paths[0].path[2][0] ) < 1.0 &&
+ Math.abs( paths[0].path[1][1] - paths[0].path[2][1] ) < 1.0 )
+ {
+ console.log( 'firstMove', paths[0].path.length );
+ lastFixed -= 2;
+ paths[0].path.shift(); // remove front
+ paths[0].path.shift(); // remove first identical
+ paths[0].path[0] = pos; // remove second identical by setting it to the first
+ }
draw();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|