manuelVo / foundryvtt-drag-ruler

A Foundry VTT module that shows a ruler when dragging tokens so you can see how far you've dragged them
MIT License
40 stars 52 forks source link

Gridless snapping snaps to incorrect increments #336

Closed BoltsJ closed 1 month ago

BoltsJ commented 1 month ago

On gridless scenes, the snap increments are significantly inaccurate, and can snap too close or too far. It's hard to tell if there's any sort of pattern as consecutive moves in roughly the same direction will have different amounts of error. The error happens on both chromium and firefox. image Screenshot from 2024-07-28 13-25-42 Screenshot from 2024-07-28 13-25-58

There are no console errors, but there are an overwhelming number of deprecation warnings.

n0q commented 1 month ago

This is affecting me, too. I can't use drag ruler in its present state.

I'm pretty sure this happens, superficially, due to ruler.rulerOffset. On v11, there was an offset calculation so that if you grabbed a token off-center, the endpoints would be auto-adjusted to the token center. On v12, this is no longer necessary, so that rulerOffset was double-correcting, and removed. Unfortunately, it seems like the offset is still needed for grid snapping.

That is to say, if you grab the token dead center, it'll 'mostly work'. One hacky way to resolve this might be to use ruler.rulerOffset but only for calculating grid snap endpoints. I think it would get most people going, at least.