|
@@ -1650,7 +1650,7 @@ Viewport.prototype.updateMatrix = function()
|
|
{
|
|
{
|
|
if(this.matrixNeedsUpdate)
|
|
if(this.matrixNeedsUpdate)
|
|
{
|
|
{
|
|
- this.matrix.m = [1, 0, 0, 1, this.position.x, this.position.y];
|
|
|
|
|
|
+ this.matrix.m = [1, 0, 0, 1, -this.position.x, -this.position.y];
|
|
|
|
|
|
if(this.rotation !== 0)
|
|
if(this.rotation !== 0)
|
|
{
|
|
{
|
|
@@ -1658,12 +1658,14 @@ Viewport.prototype.updateMatrix = function()
|
|
var s = Math.sin(this.rotation);
|
|
var s = Math.sin(this.rotation);
|
|
this.matrix.multiply(new Matrix([c, s, -s, c, 0, 0]));
|
|
this.matrix.multiply(new Matrix([c, s, -s, c, 0, 0]));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if(this.scale !== 1)
|
|
if(this.scale !== 1)
|
|
{
|
|
{
|
|
this.matrix.scale(this.scale, this.scale);
|
|
this.matrix.scale(this.scale, this.scale);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ this.matrix.multiply(new Matrix([1, 0, 0, 1, this.position.x - this.canvas.width / 2 * this.scale, this.position.y - this.canvas.height / 2 * this.scale]));
|
|
|
|
+
|
|
this.inverseMatrix = this.matrix.getInverse();
|
|
this.inverseMatrix = this.matrix.getInverse();
|
|
this.matrixNeedsUpdate = false;
|
|
this.matrixNeedsUpdate = false;
|
|
}
|
|
}
|
|
@@ -1815,6 +1817,8 @@ ViewportControls.prototype.update = function(pointer)
|
|
* Its also resposible for managing the canvas state.
|
|
* Its also resposible for managing the canvas state.
|
|
*
|
|
*
|
|
* @class
|
|
* @class
|
|
|
|
+ * @param {DOM} canvas Canvas to render the content.
|
|
|
|
+ * @param {Object} options Renderer canvas options.
|
|
*/
|
|
*/
|
|
function Renderer(canvas, options)
|
|
function Renderer(canvas, options)
|
|
{
|
|
{
|
|
@@ -1888,8 +1892,8 @@ Renderer.prototype.createRenderLoop = function(group, viewport, onUpdate)
|
|
*
|
|
*
|
|
* Should be called at a fixed rate preferably using the requestAnimationFrame() method, its also possible to use the createRenderLoop() method, that automatically creates a infinite render loop.
|
|
* Should be called at a fixed rate preferably using the requestAnimationFrame() method, its also possible to use the createRenderLoop() method, that automatically creates a infinite render loop.
|
|
*
|
|
*
|
|
- * @param object Object to be updated.
|
|
|
|
- * @param viewport Viewport to be updated (should be the one where the objects will be rendered after).
|
|
|
|
|
|
+ * @param object {Object2D} Object to be updated.
|
|
|
|
+ * @param viewport {Viewport} Viewport to be updated (should be the one where the objects will be rendered after).
|
|
*/
|
|
*/
|
|
Renderer.prototype.update = function(object, viewport)
|
|
Renderer.prototype.update = function(object, viewport)
|
|
{
|
|
{
|