Revision: 15042
          http://sourceforge.net/p/skim-app/code/15042
Author:   hofman
Date:     2025-03-29 16:03:09 +0000 (Sat, 29 Mar 2025)
Log Message:
-----------
bezelWidth only changes when number of colors changes

Modified Paths:
--------------
    trunk/SKColorSwatch.m

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2025-03-29 16:00:16 UTC (rev 15041)
+++ trunk/SKColorSwatch.m       2025-03-29 16:03:09 UTC (rev 15042)
@@ -476,7 +476,8 @@
 }
 
 - (void)setColors:(NSArray *)newColors {
-    NSUInteger i, iMax = [newColors count], oldCount = [itemViews count];
+    NSUInteger i, iMax = [newColors count];
+    BOOL changeSize = iMax != [itemViews count];
     if (selectedIndex != -1 && (selectedIndex >= (NSInteger)iMax || 
[[newColors objectAtIndex:selectedIndex] isEqual:[[itemViews 
objectAtIndex:selectedIndex] color]] == NO))
         [self deactivate];
     for (i = 0; i < iMax; i++) {
@@ -495,9 +496,11 @@
         [[itemViews objectAtIndex:iMax] removeFromSuperview];
         [itemViews removeObjectAtIndex:iMax];
     }
-    if (autoResizes && iMax != oldCount)
-        [self sizeToFit];
-    [self setBezelWidth:[self contentWidth]];
+    if (changeSize) {
+        if (autoResizes)
+            [self sizeToFit];
+        [self setBezelWidth:[self contentWidth]];
+    }
     [self updateItemViewFramesAnimating:NO];
     [[NSNotificationCenter defaultCenter] 
postNotificationName:SKColorSwatchColorsChangedNotification object:self];
     if (focusedIndex >= (NSInteger)iMax)

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

Reply via email to