Skip to content

Animated transition in/out of Quick View #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 5, 2015
Merged

Conversation

jtbandes
Copy link
Contributor

@jtbandes jtbandes commented Sep 1, 2015

As Quick View feels a lot like Quick Look, I thought it would be nice to have some smooth transitions. (It would be nice for the title bar to fade at the same time, but I didn't do that in this commit.)

  • Use 2 snapshot layers to animate the transition in/out of Quick View
  • Rename Document's _containerView to _mapContainerView, to make its purpose more evident
  • Link QuartzCore.framework

@@ -880,11 +886,11 @@ - (void)_showHelpWithIdentifier:(NSString*)identifier {
XLOG_DEBUG_UNREACHABLE();
}
if (showHelp) {
NSRect contentBounds = [_mainWindow.contentView bounds];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had problems with NSRect rect = view.bounds that doesn't compile in Xcode 6 or 7, I don't remember, so you have to do do [view bounds] instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried 6 and 7 and it seems to work.

window.contentView.bounds didn't work because contentView was id until the 10.11 SDK (when it becomes __kindof NSView*).

@swisspol
Copy link
Contributor

swisspol commented Sep 1, 2015

Looks pretty good, that's a well written patch! 😄

Some high-level comments:

  • Something like this, which is a "real" contribution, cannot land until I finish http://forums.gitup.co/t/understanding-the-gitup-open-source-license/317
  • If this transition becomes animated, then the window toolbar contents, which also changes, should be animated as well: otherwise it just looks weird
  • GitUp is compatible with 10.8 and 10.9: does it work there as well?

The most important factor here is that GitUp does not animate its UI on purpose: it's all about speed and not having superfluous / distracting UI niceties.

Although you've made Quick View look nicer, it's definitely slower and therefore less responsive. I'm not fundamentally against such "enhancements" but they would need to be thought-through and most likely be disabled by default: maybe a "Enable superfluous animations" preference?

@@ -37,6 +37,7 @@
@property(nonatomic) BOOL forceShowAllTips;
- (BOOL)selectCommit:(GCCommit*)commit; // Also scrolls if needed to ensure commit is visible - Returns YES if commit was selected
- (GINode*)nodeForCommit:(GCCommit*)commit;
- (NSPoint)positionForCommit:(GCHistoryCommit*)historyCommit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should take a GCCommit for consistency with the other APIs and I think the name should reflect better what's the coordinate system e.g. -positionInViewForCommit:.

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 1, 2015

the window toolbar contents, which also changes, should be animated as well

Agreed; I didn't do it in this commit but I can add another.

GitUp is compatible with 10.8 and 10.9: does it work there as well?

Do you have recommendations for how to test this? The machines I have access to daily are 10.10 and 10.11 only.

As for a preference, I thought about that too. Something akin to OS X's

image

Happy to add that in another commit.

@swisspol
Copy link
Contributor

swisspol commented Sep 1, 2015

When I (rarely) need to double-check that something works on older OSes, I use Parallels with 10.8 and 10.9 virtual machines. You can easily get the OS images if you are an Apple registered developer.

@swisspol
Copy link
Contributor

swisspol commented Sep 1, 2015

For the preference, I think it would be OFF by default and since the animations should be OFF by default, that means its wording should be like "Enable visual effects".

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 2, 2015

Took a bit of effort to make them run in a VM, but I got there eventually 😃

After a "fun" debugging session I determined that the GIDualSplitView implementation of splitView:resizeSubviewsWithOldSize: is causing some perpetual layout-dirtying (because it calls setPosition:...) which makes it hang while trying to commit a transaction on 10.8. Since there's no comment it's hard to tell what this method is trying to achieve anyway. Any thoughts for an alternate implementation? Can this just be implemented with a holding priority? (It's hard to tell exactly what it's trying to do with no comment 😬)

@swisspol
Copy link
Contributor

swisspol commented Sep 2, 2015

I thought about it afterwards, but I'm pretty sure you can also use the free Virtual Box to test with older OS X versions.

I wouldn't worry about 10.8 if things don't work there, just disable the code path entirely so restore the exact original behavior:

if (kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber10_9) {
  // do animation
}

Regarding splitView:resizeSubviewsWithOldSize:, I don't recall exactly but it was working around some AppKit bug or issue - and yes, I should have written a comment!

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 3, 2015

Found it 😉 http://stackoverflow.com/a/30494691

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 3, 2015

Animating toolbar contents will be hard (lack of public API to get at the toolbar's view; and the fact that implicit animations don't work when hidden is involved). I think it's best left as a future improvement.

@swisspol
Copy link
Contributor

swisspol commented Sep 3, 2015

Good find WRT to the splitview 😉 and glad you were able to find a workaround for 10.8!

@swisspol
Copy link
Contributor

swisspol commented Sep 3, 2015

I think it's best left as a future improvement.

Well, that's an unfortunate tricky situation then. You have a very nice patch for sure, but the fact remains that from a UX perspective it's half-done because of the toolbar. I'd like to see this landing in some form, but it can't right now.

Can you think of any other way to smooth the toolbar change of appearance?

@jtbandes jtbandes force-pushed the anim branch 2 times, most recently from bc169d9 to 76d78a8 Compare September 4, 2015 05:15
@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 4, 2015

Turns out it wasn't as hard as I envisioned 😃

@swisspol
Copy link
Contributor

swisspol commented Sep 4, 2015

Nice! What about 10.8 too? 😄

@swisspol
Copy link
Contributor

swisspol commented Sep 4, 2015

The pref commit needs an updated title and it should be before the 2 animation commits.

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 4, 2015

Yep, tested in 10.8 and 10.9. Updating the commits now...

@jtbandes jtbandes force-pushed the anim branch 2 times, most recently from c46e687 to e56bdea Compare September 4, 2015 06:38
@swisspol
Copy link
Contributor

swisspol commented Sep 4, 2015

I just tested the final version and it looks pretty sweet! Great work!

One minor thing: the status text rendering changes briefly during the animation:

Normal:

image

During the animation:

image

Looks like the text labels become their own layer and subpixel font smoothing gets disabled or something.

@swisspol
Copy link
Contributor

swisspol commented Sep 4, 2015

Also when you have a minute, please accept the new GitUp CLA at http://forums.gitup.co/t/gitup-contributor-license-agreement/323.

@swisspol
Copy link
Contributor

swisspol commented Sep 5, 2015

This is all ready to land now. The very last thing is that text rendering I was pointing out? Do you have an idea what is causing this and if it can be avoided? If not, I don't have a problem landing it as-is.

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 5, 2015

Yes, I modified the commit to include a fix: jtbandes@fd4681c#diff-9640dac2231f3c7e87bbda41062cc757R289

I noticed there's a similar issue with the "Show" button, but it looks like it's already rendering incorrectly (no subpixel AA) in the release version of GitUp. For some reason, during the animation it does have subpixel AA. I don't think there's a similar fix since there is no drawsBackground property on that button. Also, Interface Builder lists the Bevel button style under "Discouraged Styles", so I'm inclined to think it may be somewhat unsupported...

swisspol added a commit that referenced this pull request Sep 5, 2015
Animated transition in/out of Quick View and added visual effects preference
@swisspol swisspol merged commit 08f7aa2 into git-up:master Sep 5, 2015
@swisspol
Copy link
Contributor

swisspol commented Sep 5, 2015

All right, it's merged, congrats!

@jtbandes
Copy link
Contributor Author

jtbandes commented Sep 5, 2015

🎊

@jtbandes jtbandes deleted the anim branch September 5, 2015 20:11
@rudolf-adamkovic
Copy link
Contributor

Looks awesome, thanks @jtbandes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants