Mobile Bug Fixes, Fidgety Items

Hey Folks! Spend the entire day working on bugs with Tiago. He's been handling a handful of the more system/OS-oriented things, while I've been fixing more data-related and UI stuff. The good news is that we think we have pretty much all of them solved already, or at least know how to solve without much work!

One thing not officially on the list, though, is item fidgety-ness. After finishing my bugs, I decided to take a look at this because I was struggling with item placement on mobile.

We have some helper code in the drag/drop functions to place an item near the tap coordinates in case that results in less collisions. E.g. if you try to drop item A next to B, and they overlap, the code will check the surrounding grid to see if there's a non-overlap solution, and it will prefer that.

There are a few problems, though.

For one thing, precision dragging should override this, but it doesn't. So even if you're absolutely sure you want item A to swap with B, it might move to the side and fit next to it despite your wishes. And that can mean there's no way to get the desired arrangement. So disabling it for precision drag was step one.

The next step was to look into some weird offset behavior. It's not all the time, but in certain situations, the item can offset a bit before dropping even though that offset is no better than the tap coordinates. E.g. item A overlaps B, and the app moves it further over item B and then swaps them. Ideally, if both the original and offset coords cause a swap, just choose the original coords.

And that's what I'm looking at now. I've almost got it working, but I have a bug that moves it back to where it came from instead of the tap coords. More on that tomorrow!