mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 14:38:30 +00:00
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:
parent
22bc6d2a86
commit
0a35275c1a
1 changed files with 21 additions and 0 deletions
|
@ -623,6 +623,7 @@ var TransformMatrix = new Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the values from this Matrix to the given Canvas Rendering Context.
|
* 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
|
* @method Phaser.GameObjects.Components.TransformMatrix#copyToContext
|
||||||
* @since 3.12.0
|
* @since 3.12.0
|
||||||
|
@ -640,6 +641,26 @@ var TransformMatrix = new Class({
|
||||||
return ctx;
|
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.
|
* Copy the values in this Matrix to the array given.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue