Skip to content

Commit

Permalink
set renderer size to full canvas resolution, for pixel-perfect render…
Browse files Browse the repository at this point in the history
…ings. Resolves #452
  • Loading branch information
Floppy committed May 2, 2022
1 parent eafa153 commit 0a3b7dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/javascript/src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class ObjectPreview {
setup (): void {
this.scene = new THREE.Scene()
this.renderer = new THREE.WebGLRenderer({ canvas: this.canvas })
this.camera = new THREE.PerspectiveCamera(45, this.canvas.width / this.canvas.height, 0.1, 1000)
this.camera = new THREE.PerspectiveCamera(45, this.canvas.clientWidth / this.canvas.clientHeight, 0.1, 1000)
this.camera.position.z = 50
this.renderer.setSize(this.canvas.clientWidth, this.canvas.clientHeight, false)
this.controls = new OrbitControls(this.camera, this.renderer.domElement)
this.controls.enableDamping = true
this.controls.enablePan = false
Expand Down

0 comments on commit 0a3b7dd

Please sign in to comment.