fix: CPTokenFieldToken impacted by new CPTextField sizeToFit behaviour

This commit is contained in:
Antoine Mercadal
2010-10-13 13:34:37 +02:00
parent 6c663ddf32
commit ca0c68c9bf
+7 -1
View File
@@ -974,9 +974,15 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
[super sizeToFit];
var size = [self bounds].size,
minSize = [self currentValueForThemeAttribute:@"min-size"];
minSize = [self currentValueForThemeAttribute:@"min-size"],
contentInset = [self currentValueForThemeAttribute:@"content-inset"];
size.height = minSize.height;
// this is necessary to recalculate the width of the token due to new CPTextField sizeToFit
// behaviour that doesn't resize width on bezeled textfield
size.width = [([self stringValue] || @" ") sizeWithFont:[self font]].width + contentInset.left + contentInset.right;
[self setFrameSize:size];
}