Login popup

- fix bug who dont dispose 3d when is in mobile
This commit is contained in:
Kum1ta
2024-11-15 13:04:27 +01:00
parent 778f34098e
commit aeeac1b0da
2 changed files with 12 additions and 3 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/25 00:02:19 by edbernar #+# #+# */
/* Updated: 2024/10/09 22:43:31 by edbernar ### ########.fr */
/* Updated: 2024/11/15 12:59:15 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -15,6 +15,7 @@ import { redirection, changePlayButtonMouseOverValue } from "/static/javascript/
import { LiveChat } from "/static/javascript/liveChat/main.js";
import { Home3D } from "/static/javascript/home3D/home3D.js"
import { Login } from "/static/javascript/login/main.js";
import { dispose3d } from "/static/javascript/login/3d.js";
class HomePage
{
@ -36,6 +37,7 @@ class HomePage
document.getElementById('buttonProject').addEventListener('click', () => scrollToSection(0));
document.getElementById('buttonAuthors').addEventListener('click', () => scrollToSection(1));
document.getElementById('cross-login').addEventListener('click', () => {
dispose3d();
document.getElementById('loginPopup').style.display = 'none';
document.body.style.overflow = 'auto';
});

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/13 11:36:46 by edbernar #+# #+# */
/* Updated: 2024/11/14 15:17:52 by edbernar ### ########.fr */
/* Updated: 2024/11/15 13:03:41 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -62,7 +62,6 @@ function main3d()
scene.add(group);
});
renderer.setAnimationLoop(loop);
window.addEventListener('resize', resizeCanvas);
}
@ -81,7 +80,10 @@ function dispose3d()
{
window.removeEventListener('resize', resizeCanvas);
if (renderer)
{
renderer.setAnimationLoop(null);
renderer.dispose();
}
if (scene)
{
for (let i = scene.children.length - 1; i >= 0; i--)
@ -110,6 +112,11 @@ function dispose3d()
function loop()
{
if (!renderer)
{
dispose3d();
return ;
}
renderer.render(scene, camera);
if (scene.children[3])
scene.children[3].rotation.y += 0.005;