Skip to content

Commit

Permalink
Fix window scaling #45 (#63)
Browse files Browse the repository at this point in the history
* fix scaling when window resized

* Prettify

---------

Co-authored-by: Isabel Paredes <[email protected]>
  • Loading branch information
yxzhan and IsabelParedes authored Jul 9, 2024
1 parent db28edc commit 1aac02b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ export class URDFRenderer extends THREE.WebGLRenderer {
* Refreshes the viewer by re-rendering the scene and its elements
*/
redraw(): void {
const renderSize = this.getSize(new THREE.Vector2());
this._camera.aspect = renderSize.width / renderSize.height;
this._camera.updateProjectionMatrix();
this.render(this._scene, this._camera);
}
}

0 comments on commit 1aac02b

Please sign in to comment.