|
58 | 58 | #endif |
59 | 59 | #import "SPSplitView.h" |
60 | 60 | #import "SPColorSelectorView.h" |
| 61 | +#import "SPFunctions.h" |
61 | 62 |
|
62 | 63 | #import <SPMySQL/SPMySQL.h> |
63 | 64 |
|
@@ -1931,8 +1932,15 @@ - (void)_startEditingConnection |
1931 | 1932 | [editButtonsView setAlphaValue:0.0f]; |
1932 | 1933 | [editButtonsView setHidden:NO]; |
1933 | 1934 | [editButtonsView setFrameOrigin:NSMakePoint([editButtonsView frame].origin.x, [editButtonsView frame].origin.y - 30)]; |
1934 | | - [[editButtonsView animator] setFrameOrigin:NSMakePoint([editButtonsView frame].origin.x, [editButtonsView frame].origin.y + 30)]; |
1935 | | - [[editButtonsView animator] setAlphaValue:1.0f]; |
| 1935 | + // The animation is started async because there is a bug/oddity with layer-backed views and animating frameOrigin (at least in 10.13): |
| 1936 | + // If both calls to -setFrameOrigin: are in the same method, CA would only animate the difference between those calls (which is 0 here). |
| 1937 | + // This works fine when not using layers, but then there is another issue with the progress indicator (#2903) |
| 1938 | + SPMainLoopAsync(^{ |
| 1939 | + [NSAnimationContext beginGrouping]; |
| 1940 | + [[editButtonsView animator] setFrameOrigin:NSMakePoint([editButtonsView frame].origin.x, [editButtonsView frame].origin.y + 30)]; |
| 1941 | + [[editButtonsView animator] setAlphaValue:1.0f]; |
| 1942 | + [NSAnimationContext endGrouping]; |
| 1943 | + }); |
1936 | 1944 |
|
1937 | 1945 | // Update the "Save" button state as appropriate |
1938 | 1946 | [saveFavoriteButton setEnabled:([self selectedFavorite] != nil)]; |
@@ -2975,6 +2983,13 @@ - (void)scrollViewFrameChanged:(NSNotification *)aNotification |
2975 | 2983 | // Otherwise, center |
2976 | 2984 | else { |
2977 | 2985 | connectionDetailsFrame.origin.y = (scrollViewFrame.size.height - connectionDetailsFrame.size.height)/3; |
| 2986 | + // the division may lead to values that are not valid for the current screen size (e.g. non-integer values on a |
| 2987 | + // @1x non-retina screen). The OS works something out when not using layer-backed views, but in the latter |
| 2988 | + // case the result will look like garbage if we don't fix this. |
| 2989 | + // This code is taken from Apple's "BlurryView" example code. |
| 2990 | + connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectToBase:connectionDetailsFrame]; |
| 2991 | + connectionDetailsFrame.origin.y = round(connectionDetailsFrame.origin.y); |
| 2992 | + connectionDetailsFrame = [[connectionDetailsScrollView superview] convertRectFromBase:connectionDetailsFrame]; |
2978 | 2993 | [connectionResizeContainer setFrame:connectionDetailsFrame]; |
2979 | 2994 | scrollDocumentFrame.size.height = scrollViewFrame.size.height; |
2980 | 2995 | [[connectionDetailsScrollView documentView] setFrame:scrollDocumentFrame]; |
|
0 commit comments