diff --git a/v3/src/camera/Camera-2.js b/v3/src/camera/Camera-2.js index 71d7fa481..507b5e24d 100644 --- a/v3/src/camera/Camera-2.js +++ b/v3/src/camera/Camera-2.js @@ -9,6 +9,8 @@ var Camera = function (x, y, width, height) this.state = null; this.statePositionX = 0.0; this.statePositionY = 0.0; + this.scrollX = 0.0; + this.scrollY = 0.0; }; Camera.prototype.setState = function (state) @@ -28,7 +30,7 @@ Camera.prototype.preRender = function (interpolation, renderer) stateTransform.positionX = this.x; stateTransform.positionY = this.y; - Transform.updateRoot(stateTransform); + Transform.updateRoot(stateTransform, -this.scrollX, -this.scrollY); }; Camera.prototype.postRender = function () diff --git a/v3/src/components/experimental-Transform-2.js b/v3/src/components/experimental-Transform-2.js index d24fa85ba..45e746fa3 100644 --- a/v3/src/components/experimental-Transform-2.js +++ b/v3/src/components/experimental-Transform-2.js @@ -72,7 +72,7 @@ Transform.prototype.remove = function (transform) } }; -Transform.updateRoot = function (root) +Transform.updateRoot = function (root, globalOffsetX, globalOffsetY) { var currentChild = null; var stackLength = 0; @@ -117,8 +117,8 @@ Transform.updateRoot = function (root) var p4 = tempLocal[4]; var p5 = tempLocal[5]; - transX = child.positionX; - transY = child.positionY; + transX = child.positionX + globalOffsetX; + transY = child.positionY + globalOffsetY; scaleX = child.scaleX; scaleY = child.scaleY; rotation = child.rotation; diff --git a/v3/src/renderer/webgl/WebGLRenderer.js b/v3/src/renderer/webgl/WebGLRenderer.js index afa7a9e8f..20e6d0a22 100644 --- a/v3/src/renderer/webgl/WebGLRenderer.js +++ b/v3/src/renderer/webgl/WebGLRenderer.js @@ -273,7 +273,6 @@ WebGLRenderer.prototype = { var list = state.sys.children.list; var length = list.length; - var matrixBuffer = Transform.float32Buffer; for (var index = 0; index < length; ++index) { var child = list[index]; @@ -299,7 +298,7 @@ WebGLRenderer.prototype = { this.blendMode = newBlendMode; } // drawing child - child.renderWebGL(this, child, interpolationPercentage, matrixBuffer); + child.renderWebGL(this, child, interpolationPercentage); batch = this.batch; if (batch && batch.isFull()) {