[Bug]: Token selection cleared the first time switching to a tool

Open
#5,990 2 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
java
Domain
desktop, game-dev

Research direction

Start by reproducing the steps in MapTool 1.18.6, then trace how tool switches and layer changes affect token selection. The issue names no files or tests, so locate the relevant tool-selection and token-selection code before deciding where to investigate; done means switching tools and layers no longer clears the selected token.

Written by the indexing model from the issue text.

Description

bug
Describe the Bug

If a token is selected using the Pointer Tool, then the user switches to a different tool, the token selection is cleared. This only happens the first time the users switches to that particular tool, at least since that last time they switched layers. I.e., repeating the process with the same tool will not clear the token selection, but switching to a different tool will clear the token selection. Changing layers seems to reset everything.

To Reproduce
  1. Open a fresh instance of MapTool
  2. Drop a token on the map and make sure it is selected.
  3. Click the "Measure distance along path" tool
    • Notice the token gets deselected.
  4. Switch back to the "Pointer Tool" and select the token again.
  5. Once again select the "Measure distance along path" tool
    • Notice the token is not deselected
  6. Now select "Drawing Tools" (should switch to the "Delete drawing tool")
    • Notice the token is deselected this time.
  7. Now switch layers and drop a new token, repeating the above steps.
    • The same sort of behaviour should be observed.
  8. Switch back to the original layer, and repeat the above steps.
    • Note that we're back to each tool clearing the selection at first.
Expected Behaviour

We should always maintain the token selection. At least some tools need this to work properly, e.g., Fog of War tools for Individual FoW support.

We might not always want to render the selection border for tokens depending on the selected tool. E.g., now that drawings have their own selections, maybe it would be confusing to see the token selection border with the Drawing Tools open. But the token selection itself should be left intact.

Screenshots

No response

MapTool Info

1.18.6

Desktop

Linux Mint 22.3

Additional Context

No response

Dominant language
Java
Stars
927
Forks
286
Avg merge
3d 17h
Merged PRs (30d)
94

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from RPTools/maptool

All issues in RPTools/maptool

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.