Phergus wrote:The reversed logic for useDistance has already been fixed in the development code.
Yes, I know. I just haven't been able to see the change yet.
You have the relationship backwards. Snap-to-grid for tokens (where tokens == PCs/NPCs) has nothing to do with what grid cell the top-left corner of the token image falls in. It is about placing the token such that the center of its footprint is centered on a specific grid cell. This is true for hex or square grids.
I'll have to disagree with you there. The observed behavior for both square and hex uses the upper left corner to snap to grid. The only exception is the token layer for square grids and I recall Az mentioning some work was done for that. For a square grid on the token layer only, then snap occurs when the center of token goes in to a new square. I actually mentioned that in a bug report recently:
http://forums.rptools.net/viewtopic.php ... 57#p182662, but I mentioned it as a desired behavior.
Note that on both grid types the token image can extend well outside of its nominal footprint and normally does with tokens on hex grids.
Yes, that's because of the snap. If you unsnap the token in a hex grid, you'll see the true position of the token. That's demonstrated in the last picture of this post:
http://forums.rptools.net/viewtopic.php ... 15#p182739. This is not the behavior of b77 for copyToken, but before b77.
The correct math has to be done to position the token image properly in relation to the target cell taking into account both footprint, positioning of the image relative to footprint and image dimensions. This is easier on square grids for obvious reasons.
copyToken() should apply the same rules that dragging a token to a new location does.
I'm not going to argue about the math or footprint, that all seems fine. I was just noting because of the reverse logic in b77 for useDistance and hexes the placement of the token was different. With no grid snapping and using the map xy, when placing a hex at 0,0 we expect it to be in the center of hex 0,0, and it is. But I then turn on snap to grid, that token now jumps to -1,-1 because the grid snap grabs the upper left corner of the token (footprint, not image) and uses that to determine it's snap hex location. So, that's why when placing a token using grid units on a hex map the corner is put at location 0,0 and when using map x,y the center is placed at 0,0. Using the map x,y assumes no grid, so no snapping of grid. This can be demonstrated using
Wiki: moveToken().
Code: Select all
<!-- on hex map for token not snapped to grid, token is centered in 0,0 hex -->
<!-- on hex map for token snapped to grid, token snaps to -1,-1 hex because upper left corner appears in that hex -->
[moveToken(0,0,1)]
<!-- on hex map for token not snapped to grid, token's upper left corner is placed in center of 0,0 hex -->
<!-- on hex map for token snapped to grid, token is snapped to 0,0 hex -->
[moveToken(0,0,0)]
I seem to be getting a lot of resistance to pointing this stuff out. I'm either not describing it correctly, or people are taking this as criticism. I've tried to explain this as best I can and I'm hoping this last post will clear it up. I'm not criticizing anyone. There's been a lot of fine work done on the mapping system and just this one hiccup using useDistance for copyToken (which has been fixed) started this conversation. I agree with "It is about placing the token such that the center of its footprint is centered on a specific grid cell." but placement does matter depending on the snap-to-grid. Snap-to-grid uses the upper left corner to determine the cell it will be snapping to. This would be a whole different story if the snap happened at the center of the token like it does for the token layer on a square grid which is the only case this is true.