Using debouncing to fix an issue with selected and unselecting targets

This commit is contained in:
nsalyzyn 2025-12-17 11:40:16 -07:00
parent d86c7b96ce
commit a7abc589f2

View file

@ -305,13 +305,14 @@ const updateAllRangeDependentEffects = async () => {
}
};
const debouncedRangeEffectCall = foundry.utils.debounce(updateAllRangeDependentEffects, 50);
Hooks.on('targetToken', async (user, token, targeted) => {
// TODO: There is a bug when you untarget one token and retarget a new one
await updateAllRangeDependentEffects();
debouncedRangeEffectCall();
});
Hooks.on('moveToken', async (movedToken, data) => {
await updateAllRangeDependentEffects();
debouncedRangeEffectCall();
});
Hooks.on('renderCompendiumDirectory', (app, html) => applications.ui.ItemBrowser.injectSidebarButton(html));