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

Feature request: grid snapping #40

Open
lnmiltz opened this issue Jul 24, 2022 · 0 comments
Open

Feature request: grid snapping #40

lnmiltz opened this issue Jul 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request parked Parked for review at a later date.

Comments

@lnmiltz
Copy link

lnmiltz commented Jul 24, 2022

Is your feature request related to a problem? Please describe.
Moving portals around the desktop is easy enough, but aligning them in a grid can be difficult. It usually involves opening a calculator and figuring out the correct size & position for each portal, then typing them in manually.

Grid snapping on the desktop would be handy for aligning your portals without having to fiddle with each portal as much.

Describe the solution you'd like
In the Portals window (maybe under 'Home' or the top of 'Settings'), there would be a few settings next to each other:

  • Enable Grid Snapping
  • Grid Width (Pixels)
  • Grid Height (Pixels)
  • Grid Horizontal Offset (Pixels)
  • Grid Vertical Offset (Pixels)
  • Grid Anchor Location:
    • Top Left (default), Top Right, Bottom Left, Bottom Right

The grid offsets are useful in case you want your portals on a 32x32 grid, but distanced from the edge of the screen by 8px to account for the taskbar, the current wallpaper, or something else.

With a grid size of 64x64 and an offset of 32x32, the grid would act like this:

image

(the grid doesn't need to be visualized)

With an offset of 96x96 or even 672x672, the grid would still act like that. This may not be ideal for everyone but I think it's OK enough for most use cases; it will just be a little inconvenient starting the grid in the middle of your screen.

The grid anchor location can also be changed, though this isn't necessary and only saves a little math for users who want the grid to start from a different corner of the screen. The coordinate system in Portals starts from the top left. This doesn't change; the grid anchor location only affects how grid snapping works.

Example behavior:
(the code isn't exact, just illustrates that the other anchor modes require grid snapping to factor in window size as well)
Regular snapping: (window_pos.x + grid_offset.x + grid_size.x / 2) % grid_size.x
Inverted snapping: (window_pos.x - grid_offset.x - grid_size.x / 2 + window_size.x) % grid_size.x

  • Top left anchor (default):
    • Window X position: regular snapping
    • Window Y position: regular snapping
  • Top right anchor:
    • Window X position: inverted snapping
    • Window Y position: regular snapping
  • Bottom left anchor:
    • Window X position: regular snapping
    • Window Y position: inverted snapping
  • Bottom right anchor:
    • Window X position: inverted snapping
    • Window Y position: inverted snapping

Describe alternatives you've considered
It's not hard to pull out/open a calculator and do these calculations by hand, but grid snapping would save time and be handy for organizing your desktop portals.

I saw this issue (#32) explaining relative window positioning. While it is useful (and I might redesign my portals with it in the future), it's a little different from grid snapping.

Additional context
n/a

@lnmiltz lnmiltz added the enhancement New feature or request label Jul 24, 2022
@Ross-Patterson Ross-Patterson added the parked Parked for review at a later date. label Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request parked Parked for review at a later date.
Projects
None yet
Development

No branches or pull requests

2 participants