Revision: 16169
          http://sourceforge.net/p/skim-app/code/16169
Author:   hofman
Date:     2026-04-05 09:53:41 +0000 (Sun, 05 Apr 2026)
Log Message:
-----------
use ivar to animate instead of local variable

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

Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2026-04-05 09:44:34 UTC (rev 16168)
+++ trunk/SKStatusBar.m 2026-04-05 09:53:41 UTC (rev 16169)
@@ -159,7 +159,6 @@
     
     NSView *contentView = [view superview];
     BOOL visible = (nil == [self superview]);
-    NSLayoutConstraint *bottomLayoutConstraint = nil;
     CGFloat statusHeight = NSHeight([self frame]);
     NSArray *constraints;
     
@@ -168,16 +167,14 @@
         constraints = @[
             [[self leadingAnchor] constraintEqualToAnchor:[contentView 
leadingAnchor]],
             [[contentView trailingAnchor]constraintEqualToAnchor:[self 
trailingAnchor]],
-            [[contentView bottomAnchor] constraintEqualToAnchor:[self 
bottomAnchor] constant:animate ? -statusHeight : 0.0],
-            [[self topAnchor] constraintEqualToAnchor:[view bottomAnchor]]];
+            [[self topAnchor] constraintEqualToAnchor:[view bottomAnchor]],
+            [[contentView bottomAnchor] constraintEqualToAnchor:[self 
bottomAnchor] constant:animate ? -statusHeight : 0.0]];
         [bottomConstraint setActive:NO];
         [NSLayoutConstraint activateConstraints:constraints];
         [contentView layoutSubtreeIfNeeded];
-        bottomConstraint = bottomLayoutConstraint = [constraints 
objectAtIndex:2];
+        bottomConstraint = [constraints lastObject];
     } else {
         constraints = @[[[contentView bottomAnchor] 
constraintEqualToAnchor:[view bottomAnchor]]];
-        bottomLayoutConstraint = bottomConstraint;
-        bottomConstraint = [constraints objectAtIndex:0];
     }
     
     if (animate) {
@@ -184,7 +181,7 @@
         animating = YES;
         [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
                 [context setDuration:0.5 * [context duration]];
-                [[bottomLayoutConstraint animator] setConstant:visible ? 0.0 : 
-statusHeight];
+                [[bottomConstraint animator] setConstant:visible ? 0.0 : 
-statusHeight];
                 [[self animator] setWindowContentBorderThickness:visible ? 
statusHeight : 0.0];
             }
             completionHandler:^{
@@ -191,6 +188,7 @@
                 if (visible == NO) {
                     [self removeFromSuperview];
                     [NSLayoutConstraint activateConstraints:constraints];
+                    bottomConstraint = [constraints lastObject];
                 } else {
                     // this fixes an AppKit bug, the window does not notice 
that its draggable areas change
                     [[self window] setMovableByWindowBackground:YES];
@@ -203,6 +201,7 @@
         [self removeFromSuperview];
         [NSLayoutConstraint activateConstraints:constraints];
         [contentView layoutSubtreeIfNeeded];
+        bottomConstraint = [constraints lastObject];
     } else {
         [[self window] setContentBorderThickness:statusHeight 
forEdge:NSRectEdgeMinY];
     }

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