From 5061ef6031fdae273e49c2a88bacd7887bd49c94 Mon Sep 17 00:00:00 2001 From: Koichi Miyamoto Date: Sat, 4 Jan 2020 09:30:46 +0900 Subject: [PATCH] Fix scale calculation about view offset in OrthographicCamera In scaleW / zoomW, there are (this.view.width) in the numerator and denominator --- src/cameras/OrthographicCamera.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cameras/OrthographicCamera.js b/src/cameras/OrthographicCamera.js index 532da017b7244..c9a923cab9ba8 100755 --- a/src/cameras/OrthographicCamera.js +++ b/src/cameras/OrthographicCamera.js @@ -105,15 +105,13 @@ OrthographicCamera.prototype = Object.assign( Object.create( Camera.prototype ), if ( this.view !== null && this.view.enabled ) { - var zoomW = this.zoom / ( this.view.width / this.view.fullWidth ); - var zoomH = this.zoom / ( this.view.height / this.view.fullHeight ); - var scaleW = ( this.right - this.left ) / this.view.width; - var scaleH = ( this.top - this.bottom ) / this.view.height; - - left += scaleW * ( this.view.offsetX / zoomW ); - right = left + scaleW * ( this.view.width / zoomW ); - top -= scaleH * ( this.view.offsetY / zoomH ); - bottom = top - scaleH * ( this.view.height / zoomH ); + var scaleW = ( this.right - this.left ) / this.view.fullWidth / this.zoom; + var scaleH = ( this.top - this.bottom ) / this.view.fullHeight / this.zoom; + + left += scaleW * this.view.offsetX; + right = left + scaleW * this.view.width; + top -= scaleH * this.view.offsetY; + bottom = top - scaleH * this.view.height; }