diff --git a/src/viewer/index.ts b/src/viewer/index.ts index 71106e2..9a0d8a5 100644 --- a/src/viewer/index.ts +++ b/src/viewer/index.ts @@ -45,6 +45,8 @@ class Viewer { targetZoom = 5; minZoomLevel = 1; maxZoomLevel = 10; + frameCount = 0; + raycastFrameInterval = 16; constructor (config?: Record) { this.config = { ...this.config, ...config }; @@ -215,6 +217,10 @@ class Viewer { return; } + if (this.frameCount % this.raycastFrameInterval !== 0) { + return; + } + const satelliteIds = this.findSatellitesAtMouse({ x: event.clientX, y: event.clientY @@ -324,6 +330,8 @@ class Viewer { if (this.renderer) { this.renderer.render(this.scene as SatelliteOrbitScene, this.camera as Camera); } + + this.frameCount++; } getSatelliteStore () {