Skip to content

Commit 741b93d

Browse files
committed
Fixed parent issues with TextStyle, and moved methods into Text for ease of access.
1 parent a87f1ca commit 741b93d

3 files changed

Lines changed: 70 additions & 8 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '1d0bfb40-0d87-11e7-9b68-557cdb38920d'
2+
build: '0f082750-0d8a-11e7-b206-7db386f7c304'
33
};
44
module.exports = CHECKSUM;

v3/src/gameobjects/text/TextStyle.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,7 @@ var TextStyle = new Class({
9797
this.metrics = MeasureText(this);
9898
}
9999

100-
this.parent.updateText();
101-
102-
return this.text;
100+
return this.parent.updateText();
103101
},
104102

105103
setStyle: function (style)

v3/src/gameobjects/text/static/Text.js

Lines changed: 68 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ var Text = new Class({
3232
GameObject.call(this, state);
3333

3434
this.setPosition(x, y);
35+
this.setOrigin(0, 0);
3536

3637
/**
3738
* @property {HTMLCanvasElement} canvas - The canvas element that the text is rendered.
@@ -86,6 +87,71 @@ var Text = new Class({
8687
return this.style.setStyle(style);
8788
},
8889

90+
setFont: function (font)
91+
{
92+
return this.style.setFont(font);
93+
},
94+
95+
setFixedSize: function (width, height)
96+
{
97+
return this.style.setFixedSize(width, height);
98+
},
99+
100+
setBackgroundColor: function (color)
101+
{
102+
return this.style.setBackgroundColor(color);
103+
},
104+
105+
setFill: function (color)
106+
{
107+
return this.style.setFill(color);
108+
},
109+
110+
setStroke: function (color, thickness)
111+
{
112+
return this.style.setStroke(color, thickness);
113+
},
114+
115+
setShadow: function (x, y, color, blur, shadowStroke, shadowFill)
116+
{
117+
return this.style.setShadow(x, y, color, blur, shadowStroke, shadowFill);
118+
},
119+
120+
setShadowOffset: function (x, y)
121+
{
122+
return this.style.setShadowOffset(x, y);
123+
},
124+
125+
setShadowColor: function (color)
126+
{
127+
return this.style.setShadowColor(color);
128+
},
129+
130+
setShadowBlur: function (blur)
131+
{
132+
return this.style.setShadowBlur(blur);
133+
},
134+
135+
setShadowStroke: function (enabled)
136+
{
137+
return this.style.setShadowStroke(enabled);
138+
},
139+
140+
setShadowFill: function (enabled)
141+
{
142+
return this.style.setShadowFill(enabled);
143+
},
144+
145+
setAlign: function (align)
146+
{
147+
return this.style.setAlign(align);
148+
},
149+
150+
setMaxLines: function (max)
151+
{
152+
return this.style.setMaxLines(max);
153+
},
154+
89155
updateText: function ()
90156
{
91157
var canvas = this.canvas;
@@ -132,10 +198,6 @@ var Text = new Class({
132198
context.fillRect(0, 0, w, h);
133199
}
134200

135-
// DEBUG
136-
context.fillStyle = '#ff00ff';
137-
context.fillRect(0, 0, w, h);
138-
139201
style.syncFont(canvas, context);
140202

141203
var linePositionX;
@@ -181,6 +243,8 @@ var Text = new Class({
181243
context.fillText(lines[i], linePositionX, linePositionY);
182244
}
183245
}
246+
247+
return this;
184248
}
185249
});
186250

0 commit comments

Comments
 (0)