-
Notifications
You must be signed in to change notification settings - Fork 503
Add Floating Grid Layout #1604
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
base: development
Are you sure you want to change the base?
Add Floating Grid Layout #1604
Conversation
3a48e5e
to
5e4bac2
Compare
Sorry I haven't had a chance to look at this! It seems neat, I just need to think about it a bit more. |
5e4bac2
to
4b39101
Compare
I've added a demo build here: |
Made a few changes following the rebase, as the approach I was using to detect window position & size changes stopped working. This build integrates directly with the window resizing and repositioning handlers to trigger the grid snapping, so it should be much more robust. https://github.com/MutatingFunc/Amethyst/releases/tag/floating-grid-demo-2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall seems like a cool change. I think some of this could be extended to support custom layouts, but I am okay with this being a native layout. It seems pretty easy to maintain.
DEAD_CODE_STRIPPING = YES; | ||
DEFINES_MODULE = YES; | ||
DEVELOPMENT_TEAM = ""; | ||
DEVELOPMENT_TEAM = VKFDYMU9HJ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you revert these?
|
||
guard layout is PanedLayout else { | ||
if layout is FloatingGridLayout, case .doneDragging = mouseStateKeeper.state { | ||
screenManager.setNeedsReflow(withWindowChange: .layoutChange) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think .layoutChange
is right. That is for when the currently selected layout changes. We may need a different one for specifically window resizes.
Hey, thanks for the feedback, makes sense! I think this came through day 1 of my 4 week holiday abroad though so I’ll get back to this when I’m at my laptop properly again in May! |
…esizesWindows check
ba2bece
to
f6b4de8
Compare
Hey, I'm back! I've removed my team ID from the Git history for security/privacy, and generalised the window resize event. However, the resize event is still only triggered for the Floating Grid layout, for efficiency. Potentially it could be worth looking at generalising this down the road to a protocol if it makes sense for other layout types to observe the event. |
Does this now look good to merge? |
This looks very cool! |
For more information about the thought behind this approach:
https://mutatingfunc.github.io/blog/2023-11-03-macos-amethyst-window-snapping/
Short version - iPad-style grid alignment.
Longer version - Floating layout, but windows are snapped to a grid to make it easier to align them.
Demo build download (updated 2025.03.21)