On Sun, Nov 14, 2021 at 10:57 AM Dominik Vogt <dominik.v...@gmx.de> wrote:
>
> The snapping code is really an unmaintainable mess.  Some thoughts
> on how it might be rewritten:
>

Here are some thoughts I have, you can see them in js/snapattract branch.

I have split the three different snapping checks into individual
functions for Monitor Edges, Windows, and Grid. I have then set up a
priority of Monitor > Windows > Grid, so this way when something is
found to snap too, it stops looking for other things based on the
priority, and this should stop some of the strange interactions
between deciding what to snap too. I also treat horizontal and
vertical independently so it can snap to both a window and a monitor
edge in different directions. Currently the priority is hardcoded, but
since the checks are now individual functions, it could be possible to
set it up so the user can configure what snap priority. Comments
welcome.

jaimos

Reply via email to