Skip to content

Commit 855e6ba

Browse files
committed
Lines use strokeColor only
1 parent 2816f29 commit 855e6ba

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/gameobjects/shape/line/Line.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var Line = new Class({
3232

3333
initialize:
3434

35-
function Line (scene, x, y, x1, y1, x2, y2, fillColor, fillAlpha)
35+
function Line (scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha)
3636
{
3737
if (x === undefined) { x = 0; }
3838
if (y === undefined) { y = 0; }
@@ -52,9 +52,9 @@ var Line = new Class({
5252
this.setPosition(x, y);
5353
this.setSize(width, height);
5454

55-
if (fillColor !== undefined)
55+
if (strokeColor !== undefined)
5656
{
57-
this.setFillStyle(fillColor, fillAlpha);
57+
this.setStrokeStyle(1, strokeColor, strokeAlpha);
5858
}
5959

6060
this.updateDisplayOrigin();
@@ -67,6 +67,8 @@ var Line = new Class({
6767
this._startWidth = startWidth;
6868
this._endWidth = endWidth;
6969

70+
this.lineWidth = startWidth;
71+
7072
return this;
7173
},
7274

src/gameobjects/shape/line/LineFactory.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ var Line = require('./Line');
2121
* @param {number} [y1=0] - The horizontal position of the first point in the triangle.
2222
* @param {number} [x2=128] - The horizontal position of the second point in the triangle.
2323
* @param {number} [y2=0] - The horizontal position of the second point in the triangle.
24-
* @param {number} [fillColor] - The color the triangle will be filled with, i.e. 0xff0000 for red.
25-
* @param {number} [fillAlpha] - The alpha the triangle will be filled with. You can also set the alpha of the overall Shape using its `alpha` property.
24+
* @param {number} [strokeColor] - The color the triangle will be stroked with, i.e. 0xff0000 for red.
25+
* @param {number} [strokeAlpha] - The alpha the triangle will be stroked with. You can also set the alpha of the overall Shape using its `alpha` property.
2626
*
2727
* @return {Phaser.GameObjects.Line} The Game Object that was created.
2828
*/
29-
GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, fillColor, fillAlpha)
29+
GameObjectFactory.register('line', function (x, y, x1, y1, x2, y2, strokeColor, strokeAlpha)
3030
{
31-
return this.displayList.add(new Line(this.scene, x, y, x1, y1, x2, y2, fillColor, fillAlpha));
31+
return this.displayList.add(new Line(this.scene, x, y, x1, y1, x2, y2, strokeColor, strokeAlpha));
3232
});

src/gameobjects/shape/line/LineWebGLRenderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ var LineWebGLRenderer = function (renderer, src, interpolationPercentage, camera
5353
var dy = src._displayOriginY;
5454
var alpha = camera.alpha * src.alpha;
5555

56-
if (src.isFilled)
56+
if (src.isStroked)
5757
{
5858
var strokeTint = pipeline.strokeTint;
59-
var color = Utils.getTintAppendFloatAlphaAndSwap(src.fillColor, src.fillAlpha * alpha);
59+
var color = Utils.getTintAppendFloatAlphaAndSwap(src.strokeColor, src.strokeAlpha * alpha);
6060

6161
strokeTint.TL = color;
6262
strokeTint.TR = color;

0 commit comments

Comments
 (0)