Revision: 14100
http://sourceforge.net/p/skim-app/code/14100
Author: hofman
Date: 2024-03-12 22:37:41 +0000 (Tue, 12 Mar 2024)
Log Message:
-----------
animate content border thickness when animating status bar visibility
Modified Paths:
--------------
trunk/SKStatusBar.m
Modified: trunk/SKStatusBar.m
===================================================================
--- trunk/SKStatusBar.m 2024-03-11 14:06:52 UTC (rev 14099)
+++ trunk/SKStatusBar.m 2024-03-12 22:37:41 UTC (rev 14100)
@@ -42,6 +42,7 @@
#import "NSEvent_SKExtensions.h"
#import "SKApplication.h"
#import "NSView_SKExtensions.h"
+#import <Quartz/Quartz.h>
#define LEFT_MARGIN 8.0
#define RIGHT_MARGIN 16.0
@@ -66,6 +67,12 @@
@synthesize animating, leftField, rightField, progressIndicator;
@dynamic visible, icon, progressIndicatorStyle;
++ (id)defaultAnimationForKey:(NSString *)key {
+ if ([key isEqualToString:@"windowContentBorderThickness"])
+ return [CABasicAnimation animation];
+ return [super defaultAnimationForKey:key];
+}
+
- (instancetype)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
@@ -129,6 +136,14 @@
return [self superview] && [self isHidden] == NO;
}
+- (CGFloat)windowContentBorderThickness {
+ return [[self window] contentBorderThicknessForEdge:NSMinYEdge];
+}
+
+- (void)setWindowContentBorderThickness:(CGFloat)thickness {
+ [[self window] setContentBorderThickness:thickness forEdge:NSMinYEdge];
+}
+
- (void)toggleBelowView:(NSView *)view animate:(BOOL)animate {
if (animating)
return;
@@ -142,7 +157,6 @@
NSArray *constraints;
if (visible) {
- [[view window] setContentBorderThickness:statusHeight
forEdge:NSMinYEdge];
[contentView addSubview:self];
constraints = @[
[[self leadingAnchor] constraintEqualToAnchor:[contentView
leadingAnchor]],
@@ -160,14 +174,13 @@
if (animate) {
animating = YES;
- CGFloat target = visible ? 0.0 : -statusHeight;
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *context){
[context setDuration:0.5 * [context duration]];
- [[bottomConstraint animator] setConstant:target];
+ [[bottomConstraint animator] setConstant:visible ? 0.0 :
-statusHeight];
+ [[self animator] setWindowContentBorderThickness:visible ?
statusHeight : 0.0];
}
completionHandler:^{
if (visible == NO) {
- [[self window] setContentBorderThickness:0.0
forEdge:NSMinYEdge];
[self removeFromSuperview];
[NSLayoutConstraint activateConstraints:constraints];
} else {
@@ -182,6 +195,8 @@
[self removeFromSuperview];
[NSLayoutConstraint activateConstraints:constraints];
[contentView layoutSubtreeIfNeeded];
+ } else {
+ [[self window] setContentBorderThickness:statusHeight
forEdge:NSMinYEdge];
}
}
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