TransformMatrix.setToContext is a new method that will set the values from the Matrix to the given Canvas Rendering Context using setTransform rather than transform.

This commit is contained in:
Richard Davey 2018-08-03 18:55:33 +01:00
parent 22bc6d2a86
commit 0a35275c1a

View file

@ -623,6 +623,7 @@ var TransformMatrix = new Class({
/**
* Copy the values from this Matrix to the given Canvas Rendering Context.
* This will use the Context.transform method.
*
* @method Phaser.GameObjects.Components.TransformMatrix#copyToContext
* @since 3.12.0
@ -640,6 +641,26 @@ var TransformMatrix = new Class({
return ctx;
},
/**
* Copy the values from this Matrix to the given Canvas Rendering Context.
* This will use the Context.setTransform method.
*
* @method Phaser.GameObjects.Components.TransformMatrix#setToContext
* @since 3.12.0
*
* @param {CanvasRenderingContext2D} ctx - The Canvas Rendering Context to copy the matrix values to.
*
* @return {CanvasRenderingContext2D} The Canvas Rendering Context.
*/
setToContext: function (ctx)
{
var matrix = this.matrix;
ctx.setTransform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]);
return ctx;
},
/**
* Copy the values in this Matrix to the array given.
*