Closed KenGitsIt closed 2 years ago
Screenshot: Notice how the token and the map note are vertically aligned, but the X position of the token is 50 less than the X position of the map note. The grid size in this example is 100.
ty for the contribution, i will check your solution tonight
Try to fix this on 2.1.9 try out and let me know
Module Version: v2.1.7
Describe the bug It seems that Foundry measures placeables from the center and tokens from the corner (or vice-versa, I'm not really sure). So if you inspect the X coordinates of a token and a map note that are aligned vertically, you'll see that the coordinates are off by half a grid square. The result is that the measurements this module use are off by half a grid square, because it fails to adjust.
To Reproduce Steps to reproduce the behavior:
Expected behavior The token should be able to interact from one square in any direction.
Screenshots If applicable, add screenshots to help explain your problem.
I've verified this behavior with map notes, staircases, and doors. Changing appropriate functions like the following seems to fix the behavior:
getNotesCenter: function (note) { const noteCenter = { x: note.x - canvas.dimensions.size/2, y: note.y - canvas.dimensions.size/2 }; return noteCenter; },
In the case of door controls, the measurement seems to be the corner of the door icon, so I used this:
getDoorCenter: function (token) { const tokenCenter = { x: token.x + token.icon.width/2 - canvas.dimensions.size/2, y: token.y + token.icon.height/2 - canvas.dimensions.size/2 }; return tokenCenter; },
I also had to put back in the calls to getDoorCenter(), since that wasn't being used.