Page 1 of 1

Scrollmap bug

Posted: 09 November 2022, 04:03
by xiongmao1298
There is a typo in scrollmap event handling setup for the down button.
At ly_studio.js:(1,900870):

e.query("#"+this.container_div.id+" .movedown").connect("onclick",this,"onMouseDown")

which is likely meant to be

e.query("#"+this.container_div.id+" .movedown").connect("onclick",this,"onMoveDown")

Re: Scrollmap bug

Posted: 09 November 2022, 08:32
by Een
We want to handle the click event so it's indeed about the mouse event onMouseDown, and the scrollmap down button works, so it's all good. No typo here :)

Re: Scrollmap bug

Posted: 09 November 2022, 15:28
by xiongmao1298
I believe why it works in some instances is because there are two sets of event handler setups:

$("movetop") && e.connect($("movetop"), "onclick", this, "onMoveTop");
$("moveleft") && e.connect($("moveleft"), "onclick", this, "onMoveLeft");
$("moveright") && e.connect($("moveright"), "onclick", this, "onMoveRight");
$("movedown") && e.connect($("movedown"), "onclick", this, "onMoveDown");

e.query("#" + this.container_div.id + " .movetop").connect("onclick", this, "onMoveTop").style("cursor", "pointer");
e.query("#" + this.container_div.id + " .movedown").connect("onclick", this, "onMouseDown").style("cursor", "pointer");
e.query("#" + this.container_div.id + " .moveleft").connect("onclick", this, "onMoveLeft").style("cursor", "pointer");
e.query("#" + this.container_div.id + " .moveright").connect("onclick", this, "onMoveRight").style("cursor", "pointer")

In the first case, the correct onMoveDown event handler is called which does a scroll by a fixed amount and prevents bubbling up to the handler that causes mouse move scrolling as expected. But when the second set ends up being used (which happens in some alpha games like Rallyman Dirt or Nova Luna), pressing the down arrow ends up calling onMouseDown instead, after which the maps keeps scrolling on mouse move, since there's no corresponding call to onMouseUp being made.

Granted, I don't have access to developer docs, so maybe they didn't setup the scrollmap properly, but the intent in the implementation appeared to be quite clear. :)

Re: Scrollmap bug

Posted: 09 November 2022, 15:43
by Een
Thanks, I looked too quickly at your first post. I'll check this.

Re: Scrollmap bug

Posted: 10 November 2022, 10:09
by Een
xiongmao1298 wrote: 09 November 2022, 15:28 Granted, I don't have access to developer docs, so maybe they didn't setup the scrollmap properly, but the intent in the implementation appeared to be quite clear. :)
Indeed quite clear that it's a mistake when looking at the code. Thanks for investigating this and providing a detailed breakdown.
This will be fixed with the next site release.

Re: Scrollmap bug

Posted: 10 November 2022, 19:18
by xiongmao1298
Great, glad it helped! 👍

Re: Scrollmap bug

Posted: 11 November 2022, 21:54
by shadowphiar
For what it's worth, this was already reported in https://studio.boardgamearena.com/bug?id=30

Re: Scrollmap bug

Posted: 13 November 2022, 09:31
by Een
shadowphiar wrote: 11 November 2022, 21:54 For what it's worth, this was already reported in https://studio.boardgamearena.com/bug?id=30
Indeed. Thanks to you too then!

Re: Scrollmap bug

Posted: 23 November 2022, 16:05
by Een
Deployed with today's release: viewtopic.php?p=126767#p126767