Skip to content

Commit ff034b5

Browse files
committed
Fixed textureLine and added repeat parameter.
1 parent ab78710 commit ff034b5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/gameobjects/BitmapData.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,15 +1249,20 @@ Phaser.BitmapData.prototype = {
12491249
* @method Phaser.BitmapData#textureLine
12501250
* @param {Phaser.Line} line - A Phaser.Line object that will be used to plot the start and end of the line.
12511251
* @param {string} key - The key of an image in the Phaser.Cache to use as the texture for this line.
1252+
* @param {string} [repeat='repeat-x'] - The pattern repeat mode to use when drawing the line. Either `repeat`, `repeat-x` or `no-repeat`.
12521253
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
12531254
*/
1254-
textureLine: function (line, key) {
1255+
textureLine: function (line, key, repeat) {
1256+
1257+
if (typeof repeat === 'undefined') { repeat = 'repeat-x'; }
12551258

12561259
var image = this.game.cache.getImage(key);
12571260

1261+
this.context.fillStyle = this.context.createPattern(image, repeat);
1262+
12581263
this._circle = new Phaser.Circle(line.start.x, line.start.y, image.height);
12591264

1260-
circle.circumferencePoint(line.angle - 1.5707963267948966, false, this._pos);
1265+
this._circle.circumferencePoint(line.angle - 1.5707963267948966, false, this._pos);
12611266

12621267
this.context.save();
12631268
this.context.translate(this._pos.x, this._pos.y);

0 commit comments

Comments
 (0)