Skip to content

Commit 2c8a5d3

Browse files
committed
Renamed translate, rotate and scale to make them more explicit
1 parent caf6f30 commit 2c8a5d3

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ The following changes took place in the Pointer class:
113113
* Calling `ScaleManager.setGameSize` will now adjust the size of the canvas element as well. Fix #4482 (thanks @sudhirquestai)
114114
* `Scale.Events.RESIZE` now sends two new arguments to the handler: `previousWidth` and `previousHeight`. If, and only if, the Game Size has changed, these arguments contain the previous size, before the change took place.
115115
* The Camera Manager has a new method `onSize` which is invoked by handling the Scale Manager `RESIZE` event. When it receives it, it will iterate the cameras it manages. If the camera _doesn't_ have a custom offset and _is_ the size of the game, then it will be automatically resized for you. This means you no longer need to call `this.cameras.resize(width, height)` from within your own resize handler, although you can still do so if you wish, as that will resize _every_ Camera being managed to the new size, instead of just 'full size' cameras.
116+
* `Graphics.translate` has been renamed to `Graphics.translateCanvas` to make it clearer what it's actually translating (i.e. the drawing buffer, not the Graphics object itself)
117+
* `Graphics.scale` has been renamed to `Graphics.scaleCanvas` to make it clearer what it's actually scaling (i.e. the drawing buffer, not the Graphics object itself)
118+
* `Graphics.rotate` has been renamed to `Graphics.rotateCanvas` to make it clearer what it's actually rotating (i.e. the drawing buffer, not the Graphics object itself)
116119

117120
### Bug Fixes
118121

src/gameobjects/graphics/Graphics.js

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,17 +1335,23 @@ var Graphics = new Class({
13351335
},
13361336

13371337
/**
1338-
* Translate the graphics.
1338+
* Inserts a translation command into this Graphics objects command buffer.
1339+
*
1340+
* All objects drawn _after_ calling this method will be translated
1341+
* by the given amount.
1342+
*
1343+
* This does not change the position of the Graphics object itself,
1344+
* only of the objects drawn by it after calling this method.
13391345
*
1340-
* @method Phaser.GameObjects.Graphics#translate
1346+
* @method Phaser.GameObjects.Graphics#translateCanvas
13411347
* @since 3.0.0
13421348
*
13431349
* @param {number} x - The horizontal translation to apply.
13441350
* @param {number} y - The vertical translation to apply.
13451351
*
13461352
* @return {Phaser.GameObjects.Graphics} This Game Object.
13471353
*/
1348-
translate: function (x, y)
1354+
translateCanvas: function (x, y)
13491355
{
13501356
this.commandBuffer.push(
13511357
Commands.TRANSLATE,
@@ -1356,17 +1362,23 @@ var Graphics = new Class({
13561362
},
13571363

13581364
/**
1359-
* Scale the graphics.
1365+
* Inserts a scale command into this Graphics objects command buffer.
1366+
*
1367+
* All objects drawn _after_ calling this method will be scaled
1368+
* by the given amount.
1369+
*
1370+
* This does not change the scale of the Graphics object itself,
1371+
* only of the objects drawn by it after calling this method.
13601372
*
1361-
* @method Phaser.GameObjects.Graphics#scale
1373+
* @method Phaser.GameObjects.Graphics#scaleCanvas
13621374
* @since 3.0.0
13631375
*
13641376
* @param {number} x - The horizontal scale to apply.
13651377
* @param {number} y - The vertical scale to apply.
13661378
*
13671379
* @return {Phaser.GameObjects.Graphics} This Game Object.
13681380
*/
1369-
scale: function (x, y)
1381+
scaleCanvas: function (x, y)
13701382
{
13711383
this.commandBuffer.push(
13721384
Commands.SCALE,
@@ -1377,16 +1389,22 @@ var Graphics = new Class({
13771389
},
13781390

13791391
/**
1380-
* Rotate the graphics.
1392+
* Inserts a rotation command into this Graphics objects command buffer.
1393+
*
1394+
* All objects drawn _after_ calling this method will be rotated
1395+
* by the given amount.
1396+
*
1397+
* This does not change the rotation of the Graphics object itself,
1398+
* only of the objects drawn by it after calling this method.
13811399
*
1382-
* @method Phaser.GameObjects.Graphics#rotate
1400+
* @method Phaser.GameObjects.Graphics#rotateCanvas
13831401
* @since 3.0.0
13841402
*
13851403
* @param {number} radians - The rotation angle, in radians.
13861404
*
13871405
* @return {Phaser.GameObjects.Graphics} This Game Object.
13881406
*/
1389-
rotate: function (radians)
1407+
rotateCanvas: function (radians)
13901408
{
13911409
this.commandBuffer.push(
13921410
Commands.ROTATE,

0 commit comments

Comments
 (0)