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