浏览代码

WebGLRenderer: Storing width and height values. See #7995.

Mr.doob 9 年之前
父节点
当前提交
085a6d6c4f
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      src/renderers/WebGLRenderer.js

+ 8 - 2
src/renderers/WebGLRenderer.js

@@ -24,6 +24,9 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearColor = new THREE.Color( 0x000000 ),
 	_clearAlpha = 0,
 	_clearAlpha = 0,
 
 
+	_width = _canvas.width,
+	_height = _canvas.height,
+
 	_pixelRatio = 1;
 	_pixelRatio = 1;
 
 
 	var lights = [];
 	var lights = [];
@@ -352,14 +355,17 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.getSize = function () {
 	this.getSize = function () {
 
 
 		return {
 		return {
-			width: _canvas.width / _pixelRatio,
-			height: _canvas.height / _pixelRatio
+			width: _width,
+			height: _height
 		};
 		};
 
 
 	};
 	};
 
 
 	this.setSize = function ( width, height, updateStyle ) {
 	this.setSize = function ( width, height, updateStyle ) {
 
 
+		_width = width;
+		_height = height;
+
 		_canvas.width = width * _pixelRatio;
 		_canvas.width = width * _pixelRatio;
 		_canvas.height = height * _pixelRatio;
 		_canvas.height = height * _pixelRatio;