Revision: 12147
http://sourceforge.net/p/skim-app/code/12147
Author: hofman
Date: 2021-03-01 15:02:51 +0000 (Mon, 01 Mar 2021)
Log Message:
-----------
Always animate changes, just may not change the frame
Modified Paths:
--------------
trunk/SKColorSwatch.m
Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m 2021-03-01 14:52:41 UTC (rev 12146)
+++ trunk/SKColorSwatch.m 2021-03-01 15:02:51 UTC (rev 12147)
@@ -611,7 +611,8 @@
[[itemView animator] setFrame:[self frameForItemViewAtIndex:i++
collapsedIndex:collapsedIndex]];
if (NSEqualSizes(size, NSZeroSize) == NO) {
[[(SKColorSwatchBackgroundView *)backgroundView animator]
setWidth:size.width];
- [[self animator] setFrameSize:size];
+ if (autoResizes)
+ [[self animator] setFrameSize:size];
}
}
@@ -629,19 +630,16 @@
[self addSubview:itemView positioned:NSWindowAbove relativeTo:nil];
[itemViews insertObject:itemView atIndex:i];
[itemView release];
- if (autoResizes) {
- NSSize size = [self sizeForNumberOfColors:[colors count]];
- [self noteFocusRingMaskChanged];
- [NSAnimationContext runAnimationGroup:^(NSAnimationContext
*context){
- [self animateItemViewsCollapsing:-1 frameSize:size];
- }
- completionHandler:^{
+ NSSize size = [self sizeForNumberOfColors:[colors count]];
+ [self noteFocusRingMaskChanged];
+ [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+ [self animateItemViewsCollapsing:-1 frameSize:size];
+ }
+ completionHandler:^{
+ if (autoResizes)
[self sizeToFit];
- [self noteFocusRingMaskChanged];
- }];
- } else {
- [self updateSubviewLayout];
- }
+ [self noteFocusRingMaskChanged];
+ }];
[self didChangeColors];
}
}
@@ -649,31 +647,22 @@
- (void)removeColorAtIndex:(NSInteger)i {
if (i >= 0 && i < (NSInteger)[colors count]) {
[self deactivate];
- if (autoResizes) {
- NSSize size = [self sizeForNumberOfColors:[colors count] - 1];
- [self noteFocusRingMaskChanged];
- [NSAnimationContext runAnimationGroup:^(NSAnimationContext
*context){
- [self animateItemViewsCollapsing:i frameSize:size];
- }
- completionHandler:^{
- [self willChangeColors];
- [colors removeObjectAtIndex:i];
- [[itemViews objectAtIndex:i] removeFromSuperview];
- [itemViews removeObjectAtIndex:i];
- [self didChangeColors];
+ NSSize size = [self sizeForNumberOfColors:[colors count] - 1];
+ [self noteFocusRingMaskChanged];
+ [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
+ [self animateItemViewsCollapsing:i frameSize:size];
+ }
+ completionHandler:^{
+ [self willChangeColors];
+ [colors removeObjectAtIndex:i];
+ [[itemViews objectAtIndex:i] removeFromSuperview];
+ [itemViews removeObjectAtIndex:i];
+ [self didChangeColors];
+ if (autoResizes)
[self sizeToFit];
- [self invalidateIntrinsicContentSize];
- [self noteFocusRingMaskChanged];
- }];
- } else {
- [self willChangeColors];
- [colors removeObjectAtIndex:i];
- [[itemViews objectAtIndex:i] removeFromSuperview];
- [itemViews removeObjectAtIndex:i];
- [self didChangeColors];
- [self invalidateIntrinsicContentSize];
- [self updateSubviewLayout];
- }
+ [self invalidateIntrinsicContentSize];
+ [self noteFocusRingMaskChanged];
+ }];
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit