mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-16 13:31:18 +00:00
Added textFrame method to locate the text within the view
This commit is contained in:
1 parent
3d614b38c1
commit
bfd8eefa0e
1 file changed
+22
@@ -288,6 +288,28 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
||||
return _textShadowOffset;
|
||||
}
|
||||
|
||||
- (CGRect)textFrame
|
||||
{
|
||||
[self layoutIfNeeded];
|
||||
|
||||
var textFrame = CGRectMakeZero();
|
||||
|
||||
if (_DOMTextElement)
|
||||
{
|
||||
var textStyle = _DOMTextElement.style;
|
||||
|
||||
textFrame.origin.y = parseInt(textStyle.top.substr(0, textStyle.top.length - 2), 10),
|
||||
textFrame.origin.x = parseInt(textStyle.left.substr(0, textStyle.left.length - 2), 10),
|
||||
textFrame.size.width = parseInt(textStyle.width.substr(0, textStyle.width.length - 2), 10),
|
||||
textFrame.size.height = parseInt(textStyle.height.substr(0, textStyle.height.length - 2), 10);
|
||||
|
||||
textFrame.size.width += _textShadowOffset.width;
|
||||
textFrame.size.height += _textShadowOffset.height;
|
||||
}
|
||||
|
||||
return textFrame;
|
||||
}
|
||||
|
||||
- (void)setImage:(CPImage)anImage
|
||||
{
|
||||
if (_image == anImage)
|
||||
|
||||
Reference in new issue
Block a user