Merge pull request #2875 from dreampiggy/fix_macos_indicator_layout_center
Fix macOS SDWebImageIndicator center layout issue when indicator was initialized with 0 frame
This commit is contained in:
commit
15898ce32b
|
@ -324,9 +324,7 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL;
|
||||||
}
|
}
|
||||||
// Center the indicator view
|
// Center the indicator view
|
||||||
#if SD_MAC
|
#if SD_MAC
|
||||||
CGPoint center = CGPointMake(NSMidX(self.bounds), NSMidY(self.bounds));
|
[view setFrameOrigin:CGPointMake(round((NSWidth(self.bounds) - NSWidth(view.frame)) / 2), round((NSHeight(self.bounds) - NSHeight(view.frame)) / 2))];
|
||||||
NSRect frame = view.frame;
|
|
||||||
view.frame = NSMakeRect(center.x - NSMidX(frame), center.y - NSMidY(frame), NSWidth(frame), NSHeight(frame));
|
|
||||||
#else
|
#else
|
||||||
view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
|
view.center = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue