Login popup
- fix bug who dont dispose 3d when is in mobile
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/08/25 00:02:19 by edbernar #+# #+# */
|
/* 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 { LiveChat } from "/static/javascript/liveChat/main.js";
|
||||||
import { Home3D } from "/static/javascript/home3D/home3D.js"
|
import { Home3D } from "/static/javascript/home3D/home3D.js"
|
||||||
import { Login } from "/static/javascript/login/main.js";
|
import { Login } from "/static/javascript/login/main.js";
|
||||||
|
import { dispose3d } from "/static/javascript/login/3d.js";
|
||||||
|
|
||||||
class HomePage
|
class HomePage
|
||||||
{
|
{
|
||||||
@ -36,6 +37,7 @@ class HomePage
|
|||||||
document.getElementById('buttonProject').addEventListener('click', () => scrollToSection(0));
|
document.getElementById('buttonProject').addEventListener('click', () => scrollToSection(0));
|
||||||
document.getElementById('buttonAuthors').addEventListener('click', () => scrollToSection(1));
|
document.getElementById('buttonAuthors').addEventListener('click', () => scrollToSection(1));
|
||||||
document.getElementById('cross-login').addEventListener('click', () => {
|
document.getElementById('cross-login').addEventListener('click', () => {
|
||||||
|
dispose3d();
|
||||||
document.getElementById('loginPopup').style.display = 'none';
|
document.getElementById('loginPopup').style.display = 'none';
|
||||||
document.body.style.overflow = 'auto';
|
document.body.style.overflow = 'auto';
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2024/11/13 11:36:46 by edbernar #+# #+# */
|
/* 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);
|
scene.add(group);
|
||||||
});
|
});
|
||||||
renderer.setAnimationLoop(loop);
|
renderer.setAnimationLoop(loop);
|
||||||
|
|
||||||
window.addEventListener('resize', resizeCanvas);
|
window.addEventListener('resize', resizeCanvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +80,10 @@ function dispose3d()
|
|||||||
{
|
{
|
||||||
window.removeEventListener('resize', resizeCanvas);
|
window.removeEventListener('resize', resizeCanvas);
|
||||||
if (renderer)
|
if (renderer)
|
||||||
|
{
|
||||||
|
renderer.setAnimationLoop(null);
|
||||||
renderer.dispose();
|
renderer.dispose();
|
||||||
|
}
|
||||||
if (scene)
|
if (scene)
|
||||||
{
|
{
|
||||||
for (let i = scene.children.length - 1; i >= 0; i--)
|
for (let i = scene.children.length - 1; i >= 0; i--)
|
||||||
@ -110,6 +112,11 @@ function dispose3d()
|
|||||||
|
|
||||||
function loop()
|
function loop()
|
||||||
{
|
{
|
||||||
|
if (!renderer)
|
||||||
|
{
|
||||||
|
dispose3d();
|
||||||
|
return ;
|
||||||
|
}
|
||||||
renderer.render(scene, camera);
|
renderer.render(scene, camera);
|
||||||
if (scene.children[3])
|
if (scene.children[3])
|
||||||
scene.children[3].rotation.y += 0.005;
|
scene.children[3].rotation.y += 0.005;
|
||||||
|
Reference in New Issue
Block a user