Skip to content

Commit

Permalink
Refactor method #3839
Browse files Browse the repository at this point in the history
  • Loading branch information
BenediktMehl committed Feb 11, 2025
1 parent e7d7146 commit 8e7e8de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export class ThreeMapControlsService {
this.controls.target.set(cameraTarget.x, cameraTarget.y, cameraTarget.z)
}

updateControls() {
this.controls.update()
}

rotateCameraInVectorDirection(x: number, y: number, z: number) {
const zoom = this.getZoom()
this.lookAtDirectionFromTarget(x, y, z)
Expand All @@ -51,7 +55,7 @@ export class ThreeMapControlsService {

cameraReference.position.set(length, length, boundingSphere.center.z)

this.controls.update()
this.updateControls()

this.focusCameraViewToCenter(boundingSphere)
this.threeRendererService.render()
Expand Down Expand Up @@ -190,7 +194,7 @@ export class ThreeMapControlsService {
const newDistance = this.getDistanceFromZoomPercentage(zoom)
const direction = new Vector3().subVectors(this.threeCameraService.camera.position, this.controls.target).normalize()
this.threeCameraService.camera.position.copy(this.controls.target).add(direction.multiplyScalar(newDistance))
this.controls.update()
this.updateControls()

this.zoomPercentage$.next(zoom)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class ScenarioService {
this.threeCameraService.setPosition(scenario.camera.camera)
// @ts-ignore -- we know that it is not a partial when it is set
this.threeOrbitControlsService.setControlTarget(scenario.camera.cameraTarget)
this.threeOrbitControlsService.controls.update()
this.threeOrbitControlsService.updateControls()
}
}

Expand Down

0 comments on commit 8e7e8de

Please sign in to comment.