Revision: 15028 http://sourceforge.net/p/skim-app/code/15028 Author: hofman Date: 2025-03-27 10:07:11 +0000 (Thu, 27 Mar 2025) Log Message: ----------- Animate color swatch frame separately. Only animate item view frames that change.
Modified Paths: -------------- trunk/SKColorSwatch.m Modified: trunk/SKColorSwatch.m =================================================================== --- trunk/SKColorSwatch.m 2025-03-26 23:08:27 UTC (rev 15027) +++ trunk/SKColorSwatch.m 2025-03-27 10:07:11 UTC (rev 15028) @@ -585,12 +585,13 @@ [self setColor:color atIndex:i fromPanel:NO]; } -- (void)animateItemViewsCollapsing:(NSInteger)collapsedIndex frameSize:(NSSize)size { +- (void)animateItemViewsCollapsing:(NSInteger)collapsedIndex { NSUInteger i = 0; - for (SKColorSwatchItemView *itemView in itemViews) - [[itemView animator] setFrame:[self frameForItemViewAtIndex:i++ collapsedIndex:collapsedIndex]]; - if (NSEqualSizes(size, NSZeroSize) == NO && autoResizes) - [[self animator] setFrameSize:size]; + for (SKColorSwatchItemView *itemView in itemViews) { + NSRect frame = [self frameForItemViewAtIndex:i++ collapsedIndex:collapsedIndex]; + if (NSEqualRects(frame, [itemView frame]) == NO) + [[itemView animator] setFrame:frame]; + } } - (void)insertColor:(NSColor *)color atIndex:(NSInteger)i { @@ -609,7 +610,9 @@ NSSize size = [self sizeForNumberOfColors:[colors count]]; [self noteFocusRingMaskChanged]; [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ - [self animateItemViewsCollapsing:-1 frameSize:size]; + [self animateItemViewsCollapsing:-1]; + if (autoResizes) + [[self animator] setFrameSize:size]; } completionHandler:^{ if (autoResizes) @@ -626,7 +629,9 @@ NSSize size = [self sizeForNumberOfColors:[colors count] - 1]; [self noteFocusRingMaskChanged]; [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ - [self animateItemViewsCollapsing:i frameSize:size]; + [self animateItemViewsCollapsing:i]; + if (autoResizes) + [[self animator] setFrameSize:size]; } completionHandler:^{ [self willChangeColors]; @@ -656,7 +661,7 @@ [self addSubview:itemView positioned:NSWindowAbove relativeTo:[itemViews objectAtIndex:to - 1]]; [self noteFocusRingMaskChanged]; [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){ - [self animateItemViewsCollapsing:-1 frameSize:NSZeroSize]; + [self animateItemViewsCollapsing:-1]; } completionHandler:^{ if (to < from) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Skim-app-commit mailing list Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit