Maptool: Snap/unsnap results in jumpiness

Created on 21 Apr 2020  Â·  9Comments  Â·  Source: RPTools/maptool

Describe the bug
This is a follow up to #1589.

I have a token with snap to grid on and free sized to 7×7 squares. It’s positioned so that the top left corner is at coordinate 0,0. The center is therefore at coordinate 3,3. If I now switch snap to grid off, the token jumps around, so that the top left corner is now at coordinate 3,3, with the center at 6,6.

Steps to reproduce

  1. Add a token.
  2. Set size free size and make token bigger than one square.
  3. Check or uncheck “snap to grid”.
  4. See the token jump around.

Expected behavior
Of course there is some movement expected, as snap to grid, well, snaps it to the grid. But I’d expect that movement to be less than a square, as it would snap the center to the nearest square.

Screencast
Screen Recording 2020-04-21 at 19.13.58.mov.zip

MapTool Info

  • Version: 1.7.0 Alpha 1
  • Install: New install

Desktop (please complete the following information):

  • OS: macOS
  • Version 10.5.4

Additional context

@Azhrei mentioned:

Be careful with changing the "snap to" point. There are plenty of art packs that expect the snapping to work as it does now so that maps can be laid out one wall segment at a time and they will connect end-to-end easily.

If there are three wall segments that are snap-to-grid and they line up correctly, when snap is turned off and back on, they should still b in their original positions.

bug tested

All 9 comments

@Azhrei Is the issue with the art pack you mentioned relevant to layers other than Background?

In any case, I think everyone agrees there should be no movement when un-snapping a token from the grid.

@Azhrei https://github.com/Azhrei Is the issue with the art pack you mentioned relevant to layers other than Background?

I’m not saying there _is_ a problem, just that it’s something to check against as you’re modifying the code.

I suppose layer usage depends on how the GM builds their maps. Most likely, the walls will be on the background layer and doors will be on the object layer (along with any set dressing). That’s how I built the Godsmouth Heresy map most recently...

PR #1682 fixes this.

Note: Some movement is to be expected when initially toggling from unsnapped to snapped as the token/stamp is probably not perfectly positioned in regards to grid snap. After initial snap-to-grid all tokens/stamps should hold position during further changes of snap state.

Issues seen during testing:

  • Background stamps now jump when toggling snap on/off.

    • Hex-H, Hex-V, Iso and Gridless maps.

    • On Iso maps they slowly migrate across the map when toggled.

  • Tokens with sizes larger than Medium now jump when toggling snap.

    • Hex-H, Hex-V and Gridless (jump is small)

  • Tokens with sizes smaller than Medium now jump when toggling snap.

    • Square and Iso grids

  • Objects with sizes larger than Medium now jump when toggling snap.

    • Hex grids.

Campaign with all grid types and various tokens/stamps
AllMapTypes.cmpgn.zip

Thank you for testing all this! I had apparently forgotten to test for the Background layer, for small tokens, and for top-down tokens.

The 1 pixel jump will be tricky to solve, given that the numbers are rounded inconsistently in the zone & grid code.

Just to be clear, none of the above is in reference to the 1 pixel jump that shows up infrequently. As you say, it is rounding errors because of math being done differently in different places.

Pretty sure the large size tokens jump on Gridless maps was more than a single pixel.

Thank you for the map. It came incredibly handy while testing.

PR #1694 should fix the jumpiness for every condition.

Retested. All conditions checked out.

Was this page helpful?
0 / 5 - 0 ratings