Skip to content

Commit 51223c5

Browse files
committed
Added Graphics.fill and Graphics.stroke
1 parent 202c6c9 commit 51223c5

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
* `WebAudioSoundManager.onFocus` will not try to resume the Audio Context if it's still locked.
6464
* `WebAudioSoundManager.onBlur` will not try to suspend the Audio Context if it's still locked.
6565
* When using `ScenePlugin.add`, to add a new Scene to the Scene Manager, it didn't allow you to include the optional Scene data object. You can now pass this in the call (thanks @kainage)
66+
* `Graphics.stroke` is a new alias for the `strokePath` method, to keep the calls consistent with the Canvas Rendering Context API.
67+
* `Graphics.fill` is a new alias for the `fillPath` method, to keep the calls consistent with the Canvas Rendering Context API.
6668

6769
### Bug Fixes
6870

src/gameobjects/graphics/Graphics.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,26 @@ var Graphics = new Class({
523523
return this;
524524
},
525525

526+
/**
527+
* Stroke the current path.
528+
*
529+
* This is an alias for `Graphics.strokePath` and does the same thing.
530+
* It was added to match calls found in the Canvas API.
531+
*
532+
* @method Phaser.GameObjects.Graphics#stroke
533+
* @since 3.16.0
534+
*
535+
* @return {Phaser.GameObjects.Graphics} This Game Object.
536+
*/
537+
stroke: function ()
538+
{
539+
this.commandBuffer.push(
540+
Commands.STROKE_PATH
541+
);
542+
543+
return this;
544+
},
545+
526546
/**
527547
* Fill the given circle.
528548
*

0 commit comments

Comments
 (0)