Log in

View Full Version : Token.onHover API not being called everytime when tokens are too close



Farratto
January 8th, 2025, 18:52
I've been updating coreRPG Combat Highlighter extension and it was having a problem when tokens are too close to each. Primarily with partial overlapping, but also if they are just adjascent and you're moving the mouse quickly. It will not call every Token.onHover API that it should (i.e. it should call for each time the mouse hovers over a token and again when it hovers off the token). I've been working around this by keeping track of what gets hovered and deducing missed onHover calls. But I thought I would let you know in case it is something you'd like to fix.

Expected Behavior: Hovering over two tokens in rapid succession calls (in series) Token.onHover(tokenA, true), Token.onHover(tokenA, false), Token.onHover(tokenB, true)

Observed Behavior: Hovering over two tokens in rapid succession calls (in series) Token.onHover(tokenA, true), Token.onHover(tokenB, true)

Steps to recreate:

1.) place tokenA
2.) place tokenB with partial overlap of tokenA
3.) load extension with following code
4.) move mouse over tokenA and then tokenB
5.) check console log



fonHover = '';
function onInit()
fonHover = Token.onHover;
Token.onHover = onHoverNew
end
function onHoverNew(target, state)
if state then
Debug.console("onHover true");
else
Debug.console("onHover nil or false");
end
fonHover(target, state);
end

LordEntrails
January 8th, 2025, 19:19
What platform are you testing on? There is another threading reporting that on some Mac architectures their is a delay before onHover is recognized when mousing over objects.

Farratto
January 8th, 2025, 19:40
What platform are you testing on? There is another threading reporting that on some Mac architectures their is a delay before onHover is recognized when mousing over objects.

Windows 11. 5E ruleset (if that matters)

LordEntrails
January 8th, 2025, 19:42
Doesn't sound related. Here's the other thread is interested. https://www.fantasygrounds.com/forums/showthread.php?83824-Mouseclick-Performance-on-Mac

Moon Wizard
January 8th, 2025, 23:51
Thanks, I've passed on to Carl to review.

Regards,
JPG

pindercarl
January 9th, 2025, 16:58
I've been updating coreRPG Combat Highlighter extension and it was having a problem when tokens are too close to each. Primarily with partial overlapping, but also if they are just adjascent and you're moving the mouse quickly. It will not call every Token.onHover API that it should (i.e. it should call for each time the mouse hovers over a token and again when it hovers off the token). I've been working around this by keeping track of what gets hovered and deducing missed onHover calls. But I thought I would let you know in case it is something you'd like to fix.

Expected Behavior: Hovering over two tokens in rapid succession calls (in series) Token.onHover(tokenA, true), Token.onHover(tokenA, false), Token.onHover(tokenB, true)

Observed Behavior: Hovering over two tokens in rapid succession calls (in series) Token.onHover(tokenA, true), Token.onHover(tokenB, true)

Steps to recreate:

1.) place tokenA
2.) place tokenB with partial overlap of tokenA
3.) load extension with following code
4.) move mouse over tokenA and then tokenB
5.) check console log



fonHover = '';
function onInit()
fonHover = Token.onHover;
Token.onHover = onHoverNew
end
function onHoverNew(target, state)
if state then
Debug.console("onHover true");
else
Debug.console("onHover nil or false");
end
fonHover(target, state);
end


I'm not able to reproduce this error. Can you attach a simple CoreRPG campaign that demonstrates this?