Fixed button size when setting image by scaling down image before using it

This commit is contained in:
Michael Starke
2018-11-15 18:07:43 +01:00
parent 3fcb7305d3
commit 4b56167b56
2 changed files with 23 additions and 15 deletions

View File

@@ -102,12 +102,20 @@ typedef NS_ENUM(NSInteger, MPIconDownloadStatus) {
case MPIconDownloadStatusNone:
self.downloadIconButton.image = nil;
break;
case MPIconDownloadStatusError:
self.downloadIconButton.image = [NSImage imageNamed:NSImageNameCaution];
case MPIconDownloadStatusError: {
NSImage *image = [NSImage imageNamed:NSImageNameCaution];
CGFloat scale = image.size.width / image.size.height;
image.size = NSMakeSize(16 * scale, 16);
self.downloadIconButton.image = image;
break;
case MPIconDownloadStatusProgress:
self.downloadIconButton.image = [NSImage imageNamed:NSImageNameRefreshTemplate];
}
case MPIconDownloadStatusProgress: {
NSImage *image = [NSImage imageNamed:NSImageNameRefreshTemplate];
CGFloat scale = image.size.width / image.size.height;
image.size = NSMakeSize(16 * scale, 16);
self.downloadIconButton.image = image;
break;
}
}
}