[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: quarks:[2657] SenseWorld/contrainPoint.sc



Revision: 2657
          http://sourceforge.net/p/quarks/code/2657
Author:   nescivi
Date:     2013-11-21 15:49:08 +0000 (Thu, 21 Nov 2013)
Log Message:
-----------
SenseWorld: make a version of constrain where point is copied, rather than changed

Modified Paths:
--------------
    SenseWorld/contrainPoint.sc

Modified: SenseWorld/contrainPoint.sc
===================================================================
--- SenseWorld/contrainPoint.sc	2013-11-16 00:37:18 UTC (rev 2656)
+++ SenseWorld/contrainPoint.sc	2013-11-21 15:49:08 UTC (rev 2657)
@@ -7,4 +7,15 @@
 				y = y.clip( rect.top, rect.left + rect.height );
 			});
 	}
+
+    constrainCopy{ |rect|
+        var point = this.copy;
+		if ( rect.contains( this ).not,
+			{
+				point.x = point.x.clip( rect.left, rect.left + rect.width );
+				point.y = point.y.clip( rect.top, rect.left + rect.height );
+			});
+        ^point;
+	}
+
 }
\ No newline at end of file

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/