Skip calculating a zero size for empty RSSingleLineView and RSSingleLineRenderer.
This commit is contained in:
parent
c459bd1a4e
commit
828075454e
|
@ -120,7 +120,11 @@ static NSMutableDictionary *rendererCache = nil;
|
|||
|
||||
|
||||
- (NSSize)size {
|
||||
|
||||
|
||||
if (self.title.string.length < 1) {
|
||||
return NSZeroSize;
|
||||
}
|
||||
|
||||
if (NSEqualSizes(_size, NSZeroSize)) {
|
||||
_size = [self calculatedSize];
|
||||
}
|
||||
|
@ -173,7 +177,7 @@ static const CGFloat kMaxHeight = 10000.0;
|
|||
|
||||
CGContextSetFillColorWithColor(context, self.backgroundColor.CGColor);
|
||||
CGContextFillRect(context, r);
|
||||
|
||||
|
||||
CGContextSetShouldSmoothFonts(context, true);
|
||||
|
||||
CTFrameDraw(self.frameref, context);
|
||||
|
|
|
@ -109,7 +109,12 @@ static NSAttributedString *emptyAttributedString = nil;
|
|||
- (NSSize)intrinsicContentSize {
|
||||
|
||||
if (!self.intrinsicSizeIsValid) {
|
||||
self.intrinsicSize = ((RSSingleLineRenderer *)(self.renderer)).size;
|
||||
if (!self.attributedStringValue) {
|
||||
self.intrinsicSize = NSZeroSize;
|
||||
}
|
||||
else {
|
||||
self.intrinsicSize = ((RSSingleLineRenderer *)(self.renderer)).size;
|
||||
}
|
||||
self.intrinsicSizeIsValid = YES;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue