OpenBoard-org / OpenBoard

OpenBoard is a cross-platform interactive whiteboard application intended for use in a classroom setting.
https://openboard.ch/
GNU General Public License v3.0
2.24k stars 412 forks source link

Interactive Dice not working #1020

Open Jaq678 opened 1 week ago

Jaq678 commented 1 week ago

Everytime I try to get the interactive dice to work a black box with an arrow in the middle appears but no way to use the dice, can someone help me to use it please?

letsfindaway commented 1 week ago

Please provide more details:

Vekhir commented 1 week ago

Not OP, but Dice is an OpenBoard widget. It can be found under Interactivities -> Dice. Just DnD and the described behaviour happens.

Looking at the WebInspector inside OpenBoard, the error occurs in https://github.com/OpenBoard-org/OpenBoard/blob/1665e2e570e5e76c75d9e8a4b7e9a3f0c5071736/resources/library/interactivities/Dice.wgt/js/main.js#L155, where num is NaN, so invalid array length. num comes from https://github.com/OpenBoard-org/OpenBoard/blob/1665e2e570e5e76c75d9e8a4b7e9a3f0c5071736/resources/library/interactivities/Dice.wgt/js/main.js#L4, and app is initialised here: https://github.com/OpenBoard-org/OpenBoard/blob/1665e2e570e5e76c75d9e8a4b7e9a3f0c5071736/resources/library/interactivities/Dice.wgt/js/lib/ubw-main.js#L33-L43

Comparing with Scale.wgt, that has the function fillParameters which doesn't exist in Dice.wgt: https://github.com/OpenBoard-org/OpenBoard/blob/1665e2e570e5e76c75d9e8a4b7e9a3f0c5071736/resources/library/interactivities/Scale.wgt/js/lib/ubw-main.js#L54-L66

Manually setting num to 6 resolves the error and displays six dice. This is only academic insofar as the number of dice is supposed to be dynamically set.

System information:

OS: Arch Linux Kernel: Linux 6.9.5.arch1-1 openboard: 1.7.1-2 (via AUR) qt6-base: 6.7.1-4

letsfindaway commented 1 week ago

@Vekhir Thanks for clarification! My fault that I missed this app. Yes, I can also reproduce the problem. And also thank you very much for your error analysis. I think you're on the right track. I add the bug label here.

letsfindaway commented 1 week ago

A PR for fixing this and additionally allowing automatic updates is underway. Thanks @Jaq678 for reporting.