From 0a3b7ddac345ddbf0584d086f615cc1bbd672587 Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 2 May 2022 17:47:26 +0100 Subject: [PATCH] set renderer size to full canvas resolution, for pixel-perfect renderings. Resolves #452 --- app/javascript/src/preview.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/src/preview.ts b/app/javascript/src/preview.ts index e9dd7cf6c..4bad80562 100644 --- a/app/javascript/src/preview.ts +++ b/app/javascript/src/preview.ts @@ -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