From: Richard K. <ric...@us...> - 2005-05-24 20:29:34
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12033 Modified Files: NSPoint.as NSRect.as Log Message: added equalTo and intersectionRect Index: NSRect.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSRect.as,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NSRect.as 23 May 2005 11:10:12 -0000 1.6 --- NSRect.as 24 May 2005 20:29:25 -0000 1.7 *************** *** 107,110 **** --- 107,119 ---- return (size.width == 0) && (size.height == 0); } + + public function intersectionRect(rect:NSRect):NSRect { + var result:NSRect = new NSRect(0,0,0,0); + result.origin.x = Math.max(minX(), rect.minX()); + result.origin.y = Math.max(minY(), rect.minY()); + result.size.width = Math.min(maxX(), rect.maxX()) - result.minX(); + result.size.height = Math.min(maxY(), rect.maxY()) - result.minY(); + return (result.isEmptyRect() ? ZeroRect : result); + } public function pointInRect(point:NSPoint):Boolean { *************** *** 117,119 **** --- 126,135 ---- } + public function containsRect(rect:NSRect):Boolean { + return minX()<rect.minX() && + minY()<rect.minY() && + maxX()>rect.maxX() && + maxY()>rect.maxY(); + } + } \ No newline at end of file Index: NSPoint.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSPoint.as,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NSPoint.as 16 May 2005 22:57:08 -0000 1.2 --- NSPoint.as 24 May 2005 20:29:25 -0000 1.3 *************** *** 45,48 **** --- 45,52 ---- public var y:Number; + public function equalTo(other:NSPoint):Boolean { + return x == other.x && y == other.y; + } + /** * Creates a new instance of NSPoint with the specified x and y |