Skip to content

Commit

Permalink
Merge pull request RobotWebTools#117 from rbonghi/patch-5
Browse files Browse the repository at this point in the history
Added Resize 3D Viewer
  • Loading branch information
rctoris committed Jun 16, 2015
2 parents 4385fd6 + 889be91 commit 8d864f0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/visualization/Viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,15 @@ ROS3D.Viewer.prototype.addObject = function(object, selectable) {
this.scene.add(object);
}
};

/**
* Resize 3D viewer
*
* @param width - new width value
* @param height - new height value
*/
ROS3D.Viewer.prototype.resize = function(width, height) {
this.camera.aspect = width / height;
this.camera.updateProjectionMatrix();
this.renderer.setSize(width, height);
};

0 comments on commit 8d864f0

Please sign in to comment.