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

Fix jumpy token dragging and resizing #4946

Merged
merged 3 commits into from
Sep 26, 2024

Commits on Sep 25, 2024

  1. Configuration menu
    Copy the full SHA
    aef7a37 View commit details
    Browse the repository at this point in the history

Commits on Sep 26, 2024

  1. Refactor and fix dragging in StampTool and PointerTool

    Dragging operations are now encapsulated into special inner classes (`StampTool.TokenDragOp` and
    `PointerTool.TokenDragOp`) which track all the stack needed for a drag operation. These classes also give a convenient
    place to store some calculations that are necessary for dragging to work properly with modified token layouts.
    
    The key difference in dragging now vs before is that a drag is a displacement from a starting `ZonePoint` to a
    destination `ZonePoint`, which reflects the motion of the cursor. This displacement is then applied to the token's drag
    anchor (formerly called drag offset) to decide where to move the token. Snap-to-grid is applied at the end of the drag
    if needed. This enables smooth dragging to work without "hiccups", and allows the same for snap dragging when the token
    layout has been shifted.
    
    `SelectionSet` has been modified to accept the final point, rather than trying to work with offsets. The offset approach
    pretty well required every component to keep track of which token is moving from where in order to figure out the same
    thing: where should it end up. Now the caller can just say where the token should end up.
    
    Similar to token dragging, the free resize of stamps had a similar "hiccup" bug that has been fixed. Resizes are now
    encapsulated in `StampTool.TokenResizeOp` and works correctly whether or not the token is snap-to-grid, allows for
    aspect ratio to be preserved for rotated tokens, and respects token layout.
    
    To help with diagnosing issues during drags, new debug rendering was added to `PointerTool` and `StampTool` with a new
    developer option to enable it.
    kwvanderlinde committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    f0f2c0f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2383da4 View commit details
    Browse the repository at this point in the history