From 43e4a06f9af8ac70667e2b39bae354738f8fe33b Mon Sep 17 00:00:00 2001 From: Timon Date: Mon, 10 Oct 2022 17:17:50 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Fixed=20Crashes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stations/Graffiti.js | 4 ++-- src/stations/Paintings.js | 1 - src/systems/AreaCheckerSystem.js | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/stations/Graffiti.js b/src/stations/Graffiti.js index 62f5daf..61d748a 100644 --- a/src/stations/Graffiti.js +++ b/src/stations/Graffiti.js @@ -212,7 +212,7 @@ export function setup(ctx, hall) { drawContext.strokeStyle = "#0f0"; var dist = lastPosition.distanceTo(aux2); var angle = angleBetween(lastPosition, aux2); - let alpha = THREE.Math.clamp(1 - distance, 0, 1); + let alpha = THREE.MathUtils.clamp(1 - distance, 0, 1); drawContext.globalAlpha = alpha; @@ -221,7 +221,7 @@ export function setup(ctx, hall) { var _y = lastPosition.y + Math.cos(angle) * i; drawContext.save(); drawContext.translate(_x, _y); - let r = THREE.Math.lerp(0.001, 0.2, distance); + let r = THREE.MathUtils.lerp(0.001, 0.2, distance); drawContext.scale(r, r); drawContext.rotate((Math.PI * 180) / getRandomInt(0, 180)); diff --git a/src/stations/Paintings.js b/src/stations/Paintings.js index f3fc04b..bfdcf7f 100644 --- a/src/stations/Paintings.js +++ b/src/stations/Paintings.js @@ -118,7 +118,6 @@ function refreshZoomUV(hit) { zoom.widget.position.copy(hit.point); zoom.widget.position.x -= 0.5 * zoom.animation; - const uvs = zoom.widget.geometry.faceVertexUvs[0]; zoom.widget.material.uniforms.zoomPos.value.copy(hit.uv); zoom.widget.material.uniforms.zoomAmount.value = ZOOMS[hit.object.userData.paintingId]; } diff --git a/src/systems/AreaCheckerSystem.js b/src/systems/AreaCheckerSystem.js index 51e61c0..77dd81d 100644 --- a/src/systems/AreaCheckerSystem.js +++ b/src/systems/AreaCheckerSystem.js @@ -23,9 +23,9 @@ export class AreaCheckerSystem extends System { const checker = checkers[j]; const obj3D = checker.getComponent(Object3D).value; if (obj3D.boundingBox.intersectsBox(bboxArea)) { - checker.addComponent(AreaInside); + if(!checker.hasComponent(AreaInside)) checker.addComponent(AreaInside); } else { - checker.removeComponent(AreaInside); + if(checker.hasComponent(AreaInside)) checker.removeComponent(AreaInside); } } }