From ecaab49c08d2a6738cf17fcece862bbcb62ad59d Mon Sep 17 00:00:00 2001 From: Ross Boucher Date: Wed, 4 Feb 2009 08:52:18 -0700 Subject: [PATCH] In addition to setting the center of a view's frame, now you can query it. --- AppKit/CPView.j | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/AppKit/CPView.j b/AppKit/CPView.j index 20967cdbe..504983e56 100644 --- a/AppKit/CPView.j +++ b/AppKit/CPView.j @@ -573,6 +573,15 @@ var DOMElementPrototype = nil, [self setFrameOrigin:CGPointMake(aPoint.x - _frame.size.width / 2.0, aPoint.y - _frame.size.height / 2.0)]; } +/*! + Returns the center of the receiver's frame to the provided point. The point is defined in the superview's coordinate system. + @return CGPoint the center point of the receiver's frame +*/ +- (void)center +{ + return CGPointMake(_frame.size.width / 2.0 + _frame.origin.x, _frame.size.height / 2.0 + _frame.origin.y); +} + /*! Sets the receiver's frame origin to the provided point. The point is defined in the superview's coordinate system. The method posts a CPViewFrameDidChangeNotification to the default notification center if the receiver