mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-17 05:51:18 +00:00
Add "setCenter:" to CPView, which takes a point and moves the center of the view's frame to that point.
This commit is contained in:
1 parent
94c838dfde
commit
f671b89da5
1 file changed
+12
@@ -561,6 +561,18 @@ var DOMElementPrototype = nil,
|
||||
return _CGRectMakeCopy(_frame);
|
||||
}
|
||||
|
||||
/*!
|
||||
Moves the center of the receiver's frame 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
|
||||
is configured to do so. If the specified origin is the same as the frame's current origin, the method will
|
||||
simply return (and no notification will be posted).
|
||||
@param aPoint the new origin point
|
||||
*/
|
||||
- (void)setCenter:(CGPoint)aPoint
|
||||
{
|
||||
[self setFrameOrigin:CGPointMake(aPoint.x - _frame.size.width / 2.0, aPoint.y - _frame.size.height / 2.0)];
|
||||
}
|
||||
|
||||
/*!
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user