Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Token is offset when dragging with "Snap token while dragging" disabled #4855

Open
kwvanderlinde opened this issue Jul 9, 2024 · 2 comments
Labels

Comments

@kwvanderlinde
Copy link
Collaborator

Describe the Bug

If the preference Snap token while dragging is turned off, a snap-to-grid token will jump by half a cell down and to the right when starting to drag it. This is jarring in itself, but it also makes the whole drag feel off since the token's cell position is based off the top-left corner - the token can visibly be in one cell, but the top-left corner may be in a different cell, leading to confusion.

To Reproduce

  1. Disable the Snap token while dragging preference
  2. Add a snap-to-grid token to a gridded map.
  3. Grab the token anywhere and start to drag it.
  4. Notice the token jump half a cell down and to the right as soon as the drag begins.

Expected Behaviour

The token should not jump at all when the drag begins, and the whole operation should feel smooth for the user. Additionally, the cell that the token occupies should be based on its center, not on the top-left corner.

Screenshots

In this screenshot, the right hand token was only dragged by a pixel or two, but is offset from the grid much further than that:
image

MapTool Info

1.14.3

Desktop

Linux Mint 21.3

Additional Context

No response

@FullBleed
Copy link

What do you think the fix is for this? When people understand that the token's cell position is determined by the top left corner the current behaviour kind of makes sense... but it feels and looks off.

Are you going to change the cell position to be cursor based? Or center of token when dragging?

Are we too far down the rabbit hole to get an option to set a token's cell position as center?

Also (and this is separate issue but should be in sight when looking at this behaviour), when "Hide Mouse Pointer while dragging" is disabled, the cursor is visible during token layer drags, but not on any other layers.

@kwvanderlinde
Copy link
Collaborator Author

What do you think the fix is for this? When people understand that the token's cell position is determined by the top left corner the current behaviour kind of makes sense... but it feels and looks off.

Are you going to change the cell position to be cursor based? Or center of token when dragging?

Are we too far down the rabbit hole to get an option to set a token's cell position as center?

Also (and this is separate issue but should be in sight when looking at this behaviour), when "Hide Mouse Pointer while dragging" is disabled, the cursor is visible during token layer drags, but not on any other layers.

The only real problem here is that the token image isn't rendered in the right place. If it were a half cell up-and-left from where it currently is, it would look and feel quite natural. The fact that it's offset just messes with expectations of where the token should end up. If we fix that, the token will naturally snap according to its center, which is the same as saying that it will snap to the cell that the token is mostly within (for Medium tokens anyways).

As for options / configurations for this behaviour, we are actually well set up to support that. Internally we already query the token for its "snap point", which today accounts for the token size, grid properties, layer, etc. Details for a configurable alternative would of course depend on the specific FR, but seems feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants