bmarian / token-tooltip-alt

A module that adds a tooltip next to the currently hovered token to show some useful information for players and DMs.
MIT License
9 stars 15 forks source link

[BUG] Moving a token hindered by tooltip #113

Open C-S-McFarland opened 1 year ago

C-S-McFarland commented 1 year ago

Describe the bug When selecting a token to move, the tool-tip does not disappear once the token is dragged. Compare this to the ruler use where once you begin drawing a distance, the tool-tip goes away so that you can see clearly where you are measuring to.

To Reproduce Steps to reproduce the behavior:

  1. Click on a token to move it and observe the tool-tip as you move the token.
  2. Click on a token to measure with the ruler, once your mouse starts to move to measure, the tool-tip goes away.

Screenshots If applicable, add screenshots to help explain your problem.

Please complete the following information:

Additional context Add any other context about the problem here.

An export of your tooltip settings Please provide an export of your settings, found by going into the Tooltip manger and clicking Export.

{"gmSettings":{"default":{"items":[{"disposition":"FRIENDLY","items":[{"value":"Test","icon":"","isFunction":false,"expression":false,"isNumber":false,"color":"#30dfa8"}]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":true,"useAccentEverywhere":false,"accentColor":"#92152c","tokenDispositions":["FRIENDLY","NEUTRAL","HOSTILE"],"useAccentColorForEverything":false}},"character":{"items":[{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":true,"accentColor":"#0698d1","useAccentColorForEverything":false,"tokenDispositions":["FRIENDLY","NEUTRAL","HOSTILE"]}},"npc":{"items":[{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":true,"accentColor":"#d136db","useAccentColorForEverything":false,"tokenDispositions":["FRIENDLY","NEUTRAL","HOSTILE"]}},"vehicle":{"items":[{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":true,"accentColor":"#e159f4","useAccentColorForEverything":false,"tokenDispositions":["FRIENDLY","NEUTRAL","HOSTILE"]}}},"playerSettings":{"default":{"items":[{"disposition":"OWNED","items":[]},{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":"OWNED","useAccentEverywhere":false,"accentColor":"#eeb391","tokenDispositions":["OWNED","FRIENDLY","NEUTRAL","HOSTILE"],"useAccentColorForEverything":false}},"character":{"items":[{"disposition":"OWNED","items":[]},{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":"OWNED","accentColor":"#1dea42","useAccentColorForEverything":false,"tokenDispositions":["OWNED","FRIENDLY","NEUTRAL","HOSTILE"]}},"npc":{"items":[{"disposition":"OWNED","items":[]},{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":"OWNED","accentColor":"#68a05d","useAccentColorForEverything":false,"tokenDispositions":["OWNED","FRIENDLY","NEUTRAL","HOSTILE"]}},"vehicle":{"items":[{"disposition":"OWNED","items":[]},{"disposition":"FRIENDLY","items":[]},{"disposition":"NEUTRAL","items":[]},{"disposition":"HOSTILE","items":[]}],"static":{"displayNameInTooltip":"OWNED","accentColor":"#0c4953","useAccentColorForEverything":false,"tokenDispositions":["OWNED","FRIENDLY","NEUTRAL","HOSTILE"]}}}}
aWinglessMonkey commented 6 months ago

this can be greatly ameliorated by adding the 'refreshToken' hook to the array in removeTooltipHandlers() in TTAHooks.js, like so (~ lines 57-59?):

    ['preUpdateToken', 'refreshToken', 'canvasPan', 'deleteToken'].forEach((hook) => {
      addHookHandler(hook, HOOK_TYPE.ON, TooltipFactory.removeTooltips.bind(TooltipFactory));
    });

there's a few knock-on effects I found undesirable, but I also solved those by moving both 'refreshToken' and 'preUpdateToken' to a second array directed at a different callback I added to TooltipFactory.js (removeControlledTooltips(token) {if (token.controlled) this._removeTooltips();}); it was a problem for some specific shenanigans I'm pulling, but is probably entirely unnecessary for most people, and maybe even unwanted