Skip to content
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

List appears clipped at the top #7

Closed
ianh opened this issue Mar 23, 2021 · 8 comments · Fixed by #10
Closed

List appears clipped at the top #7

ianh opened this issue Mar 23, 2021 · 8 comments · Fixed by #10

Comments

@ianh
Copy link

ianh commented Mar 23, 2021

See attached screenshot. I believe (according to the output of top -ocpu) that this top sparkline is for WindowServer.

Screen Shot 2021-03-22 at 18 48 08

@hmarr
Copy link
Owner

hmarr commented Mar 23, 2021

Thanks for reporting. Which version of macOS are you using? I've only been able to test it on Catalina so far.

@ianh
Copy link
Author

ianh commented Mar 23, 2021

Ah yeah, it's Big Sur 11.2.2 (20D80). I looked at it in Xcode and it does look like the VStack is somehow larger than the ContentView that contains it.

image

@ianh
Copy link
Author

ianh commented Mar 23, 2021

Wrapping everything in a scroll view fixes the issue and looks nice too. I created a pull request at #8 if you're interested!

@hmarr
Copy link
Owner

hmarr commented Mar 24, 2021

Thanks for looking into this! Good to know that the scroll view fixes it. I think I'd rather avoid scrolling if possible, given that the 20 items should all easily fit in the space available.

I wonder whether wrapping the VStack in anything else (List, View, etc) helps the situation. The two other things that come to mind are adjusting the padding on the VStack, and changing the popover's contentSize.

If you have a chance to try those out and they do the trick, please do submit a PR! But no pressure 😄

Additionally, I noticed the numbers on the right look a bit smaller than the process names on the left. I'm not sure why that's happening for you – the other Big Sur screenshot I've seen doesn't seem to exhibit that behaviour.

@ianh
Copy link
Author

ianh commented Mar 24, 2021

Sounds good, thanks for taking a look. It seems like changing the contentSize of the popover so its height matches its contents would be a good solution, but I can't figure out how to get the height information out of SwiftUI.

@jlledo
Copy link
Contributor

jlledo commented Mar 24, 2021

I've gone ahead and implemented the fix @ianh suggested in PR #10, hard coded since the height can be statically decided. As I mentioned in the PR this introduces a bit of coupling, but I really can't think of any other fix.

Before settling on that I basically tested every combination of calling fixedSize(horizontal:vertical:) on the Views, but nothing seemed to work. Granted, I'm no SwiftUI expert so feel free to reject if you don't think it's appropriate.

@ianh
Copy link
Author

ianh commented Mar 26, 2021

Verified this is fixed for me in b37168e. Thanks!

@hmarr
Copy link
Owner

hmarr commented Mar 26, 2021

Great! I just published v0.3 which includes this fix. It's also available in the Homebrew tap.

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

Successfully merging a pull request may close this issue.

3 participants