Revision: 15048
          http://sourceforge.net/p/skim-app/code/15048
Author:   hofman
Date:     2025-03-29 22:31:06 +0000 (Sat, 29 Mar 2025)
Log Message:
-----------
Np need to notify focus ring changes every time, thi is often implied eg when 
size changes.

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

Modified: trunk/SKColorSwatch.m
===================================================================
--- trunk/SKColorSwatch.m       2025-03-29 16:40:29 UTC (rev 15047)
+++ trunk/SKColorSwatch.m       2025-03-29 22:31:06 UTC (rev 15048)
@@ -626,18 +626,16 @@
             selectedIndex++;
             [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY];
         }
-        if (focusedIndex >= i)
+        if (focusedIndex >= i) {
             focusedIndex++;
+            [self noteFocusRingMaskChanged];
+        }
         [self didChangeColors];
-        [self noteFocusRingMaskChanged];
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [self updateItemViewFramesAnimating:YES];
                 [[self animator] setBezelWidth:[self contentWidth]];
                 if (autoResizes)
                     [[self animator] setFrameSize:[self intrinsicFrameSize]];
-            }
-            completionHandler:^{
-                [self noteFocusRingMaskChanged];
             }];
     }
 }
@@ -656,10 +654,11 @@
             [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY];
         }
         if (focusedIndex > i ||
-            focusedIndex == (NSInteger)[itemViews count] - 1)
+            focusedIndex == (NSInteger)[itemViews count] - 1) {
             focusedIndex--;
+            [self noteFocusRingMaskChanged];
+        }
         [self didChangeColors];
-        [self noteFocusRingMaskChanged];
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [[itemView animator] setFrame:[self 
frameForCollapsedItemViewAtIndex:i]];
                 [self updateItemViewFramesAnimating:YES];
@@ -669,7 +668,6 @@
             }
             completionHandler:^{
                 [itemView removeFromSuperview];
-                [self noteFocusRingMaskChanged];
             }];
     }
 }
@@ -692,14 +690,16 @@
                 selectedIndex++;
             [self didChangeValueForKey:SELECTEDCOLORINDEX_KEY];
         }
-        if (focusedIndex == from)
-            focusedIndex = to;
-        else if (focusedIndex > from && focusedIndex <= to)
-            focusedIndex--;
-        else if (focusedIndex < from && focusedIndex >= to)
-            focusedIndex++;
+        if (focusedIndex >= MIN(from, to) && focusedIndex <= MAX(from, to)) {
+            if (focusedIndex == from)
+                focusedIndex = to;
+            else if (focusedIndex > from && focusedIndex <= to)
+                focusedIndex--;
+            else if (focusedIndex < from && focusedIndex >= to)
+                focusedIndex++;
+            [self noteFocusRingMaskChanged];
+        }
         [self didChangeColors];
-        [self noteFocusRingMaskChanged];
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [self updateItemViewFramesAnimating:YES];
             }
@@ -706,7 +706,6 @@
             completionHandler:^{
                 if (to < from)
                     [self addSubview:itemView positioned:NSWindowBelow 
relativeTo:[itemViews objectAtIndex:to + 1]];
-                [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

Reply via email to