Lobby page

- fix bug with goal selector
This commit is contained in:
Kum1ta
2024-11-15 15:09:16 +01:00
parent 3b9f386ccc
commit f838b82f0d

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */ /* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */ /* Created: 2024/09/13 13:59:46 by edbernar #+# #+# */
/* Updated: 2024/11/12 19:19:33 by edbernar ### ########.fr */ /* Updated: 2024/11/15 15:08:44 by edbernar ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -286,9 +286,11 @@ class goalSelecter
changeGoal(event) changeGoal(event)
{ {
if (!this.scene)
return ;
const popup = document.getElementById('popup-goal-selector'); const popup = document.getElementById('popup-goal-selector');
const id = event.target.parentElement.getAttribute('goalId'); const id = event.target.parentElement.getAttribute('goalId');
popup.style.display = 'none'; popup.style.display = 'none';
lastSelectedGoal = availableGoals[id]; lastSelectedGoal = availableGoals[id];
this.selected = availableGoals[id]; this.selected = availableGoals[id];
@ -319,7 +321,6 @@ class goalSelecter
{ {
const colorBoxGoal = document.getElementsByClassName('color-box-goal'); const colorBoxGoal = document.getElementsByClassName('color-box-goal');
for (let i = colorBoxGoal.length - 1; i >= 0; i--) for (let i = colorBoxGoal.length - 1; i >= 0; i--)
{ {
const canvas = colorBoxGoal[i].getElementsByTagName('canvas'); const canvas = colorBoxGoal[i].getElementsByTagName('canvas');