From: Scott H. <sco...@us...> - 2005-05-17 01:24:15
|
Update of /cvsroot/actionstep/actionstep/src/org/actionstep In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12287/src/org/actionstep Modified Files: NSView.as Log Message: Added all coordinate conversion methods Updated some comments too Index: NSView.as =================================================================== RCS file: /cvsroot/actionstep/actionstep/src/org/actionstep/NSView.as,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** NSView.as 16 May 2005 04:42:23 -0000 1.5 --- NSView.as 17 May 2005 01:24:05 -0000 1.6 *************** *** 565,569 **** } ! // Modifying the coordinate system public function translateOriginToPoint(point:NSPoint) { --- 565,571 ---- } ! //****************************************************** ! //* Modifying the coordinate system ! //****************************************************** public function translateOriginToPoint(point:NSPoint) { *************** *** 574,585 **** setBoundsRotation(boundsRotation() + angle); } ! // Modifying the coordinate system ! // Examining coordiante system modifications - // Converting coordinates ! // Controlling notifications public function setPostsFrameChangeNotifications(value:Boolean) { --- 576,680 ---- setBoundsRotation(boundsRotation() + angle); } + + //****************************************************** + //* Examining coordiante system modifications + //****************************************************** ! //****************************************************** ! //* Converting Coordinates ! //****************************************************** ! /** ! * Converts aPoint from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aPoint is converted from global coordinates (_root). ! */ ! public function convertPointFromView(aPoint:NSPoint, aView:NSView):NSPoint { ! var from:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! ! var pt:NSPoint = aPoint.clone(); ! from.localToGlobal(pt); ! mcBounds().globalToLocal(pt); ! ! return pt; ! } ! /** ! * Converts aPoint from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aPoint is converted to global coordinates (_root). ! */ ! public function convertPointToView(aPoint:NSPoint, aView:NSView):NSPoint { ! var to:MovieClip = (aView == null) ? _root : aView.mcBounds(); ! ! var pt:NSPoint = aPoint.clone(); ! mcBounds().localToGlobal(pt); ! to.globalToLocal(pt); ! ! return pt; ! } ! ! ! /** ! * Converts aSize from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aSize is converted from global coordinates (_root). ! */ ! public function convertSizeFromView(aSize:NSSize, aView:NSView):NSSize { ! var wdt:NSPoint = convertPointFromView(new NSPoint(aSize.width, 0), aView); ! var hgt:NSPoint = convertPointFromView(new NSPoint(0, aSize.height), aView); ! ! return new NSSize(wdt.x, hgt.y); ! } ! ! ! /** ! * Converts aSize from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aSize is converted to global coordinates (_root). ! */ ! public function convertSizeToView(aSize:NSSize, aView:NSView):NSSize { ! var wdt:NSPoint = convertPointToView(new NSPoint(aSize.width, 0), aView); ! var hgt:NSPoint = convertPointToView(new NSPoint(0, aSize.height), aView); ! ! return new NSSize(wdt.x, hgt.y); ! } ! ! ! /** ! * Converts aRect from the coordinate system of aView to this view's ! * coordinate system. ! * ! * If aView is null, aRect is converted from global coordinates (_root). ! */ ! public function convertRectFromView(aRect:NSRect, aView:NSView):NSRect { ! var pt:NSPoint = convertPointFromView(aRect.origin, aView); ! var sz:NSSize = convertSizeFromView(aRect.size, aView); ! ! return NSRect.withOriginSize(pt, sz); ! } ! ! ! /** ! * Converts aRect from this view's coordinate system to the coordinate ! * system of aView. ! * ! * If aView is null, aRect is converted to global coordinates (_root). ! */ ! public function convertRectToView(aRect:NSRect, aView:NSView):NSRect { ! var pt:NSPoint = convertPointToView(aRect.origin, aView); ! var sz:NSSize = convertSizeToView(aRect.size, aView); ! ! return NSRect.withOriginSize(pt, sz); ! } ! ! //****************************************************** ! //* Controlling Notifications ! //****************************************************** public function setPostsFrameChangeNotifications(value:Boolean) { |