|
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.
|
|
From: <ma...@us...> - 2011-01-20 21:01:28
|
Revision: 261
http://openautomation.svn.sourceforge.net/openautomation/?rev=261&view=rev
Author: mayerch
Date: 2011-01-20 21:01:22 +0000 (Thu, 20 Jan 2011)
Log Message:
-----------
Fix broken firstMove.
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-16 21:31:13 UTC (rev 260)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-20 21:01:22 UTC (rev 261)
@@ -157,6 +157,7 @@
this.firstMove = function( pos )
{
+ pos = [ pos.x, pos.y ]; // convert
if( Math.abs( paths[0].path[0][1] - paths[0].path[1][1] ) < 1.0 ) // keep horizontal line
{
paths[0].path[0] = pos;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-01-22 14:09:28
|
Revision: 263
http://openautomation.svn.sourceforge.net/openautomation/?rev=263&view=rev
Author: mayerch
Date: 2011-01-22 14:09:22 +0000 (Sat, 22 Jan 2011)
Log Message:
-----------
Startet functionality to simplify connection during handle move
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-22 13:30:12 UTC (rev 262)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-01-22 14:09:22 UTC (rev 263)
@@ -160,6 +160,17 @@
}
path[i][0] = pos.x;
path[i][1] = pos.y;
+ // simplify path, i.e. delete double points
+ for( var j = path.length-1; j > 0; j-- )
+ {
+ if( i == j || i == j-1 ) continue; // don't delete current point
+ if( Math.abs( path[j-1][0] - path[j][0] ) < 1.0 &&
+ Math.abs( path[j-1][1] - path[j][1] ) < 1.0 )
+ {
+ path.splice( j-1, 2 );
+ if( j < i ) ed.obj[2] -= 2;
+ }
+ }
draw();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2011-02-04 21:25:58
|
Revision: 278
http://openautomation.svn.sourceforge.net/openautomation/?rev=278&view=rev
Author: mayerch
Date: 2011-02-04 21:25:52 +0000 (Fri, 04 Feb 2011)
Log Message:
-----------
Allow connection to be extended even if it's not selected
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-02-04 21:11:53 UTC (rev 277)
+++ PyWireGate/trunk/logic_editor/gle/gle.connection.js 2011-02-04 21:25:52 UTC (rev 278)
@@ -98,10 +98,11 @@
{
var x = paths[i].path[j][0];
var y = paths[i].path[j][1];
+ var thisClass = 'move';
var style = '';
- if( j == 0 || j == paths[i].path.length-1 ) style = 'opacity:0;';
+ if( j == 0 || j == paths[i].path.length-1 ) {style = 'opacity:0;'; thisClass += 'firstlast'; }
if( inEdit && j == paths[i].path.length-1 ) style += 'display:none';
- connectionDrag( [g,i,j], canvas.rect( g, x-outset, y-outset, 1+inset+outset, 1+inset+outset, {class:'move',style:style} ) );
+ connectionDrag( [g,i,j], canvas.rect( g, x-outset, y-outset, 1+inset+outset, 1+inset+outset, {class:thisClass,style:style} ) );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|