Skip to content

Commit be74f40

Browse files
committed
Updating v2 comments to match v3 style
1 parent 9357b83 commit be74f40

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

  • v3/src/gameobjects/text/static

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ var Text = new Class({
175175
{
176176
var output = '';
177177

178-
// condense consecutive spaces and split into lines
178+
// Condense consecutive spaces and split into lines
179179
var lines = text
180180
.replace(/ +/gi, ' ')
181181
.split(/\r?\n/gi);
@@ -187,10 +187,10 @@ var Text = new Class({
187187
var line = lines[i];
188188
var out = '';
189189

190-
// trim whitespace
190+
// Trim whitespace
191191
line = line.replace(/^ *|\s*$/gi, '');
192192

193-
// if entire line is less than wordWrapWidth append the entire line and exit early
193+
// If entire line is less than wordWrapWidth append the entire line and exit early
194194
var lineWidth = context.measureText(line).width;
195195

196196
if (lineWidth < wordWrapWidth)
@@ -199,10 +199,10 @@ var Text = new Class({
199199
continue;
200200
}
201201

202-
// otherwise, calculate new lines
202+
// Otherwise, calculate new lines
203203
var currentLineWidth = wordWrapWidth;
204204

205-
// split into words
205+
// Split into words
206206
var words = line.split(' ');
207207

208208
for (var j = 0; j < words.length; j++)
@@ -213,10 +213,10 @@ var Text = new Class({
213213

214214
if (wordWidth > currentLineWidth)
215215
{
216-
// break word
216+
// Break word
217217
if (j === 0)
218218
{
219-
// shave off letters from word until it's small enough
219+
// Shave off letters from word until it's small enough
220220
var newWord = wordWithSpace;
221221

222222
while (newWord.length)
@@ -230,36 +230,36 @@ var Text = new Class({
230230
}
231231
}
232232

233-
// if wordWrapWidth is too small for even a single letter, shame user
233+
// If wordWrapWidth is too small for even a single letter, shame user
234234
// failure with a fatal error
235235
if (!newWord.length)
236236
{
237237
throw new Error('This text\'s wordWrapWidth setting is less than a single character!');
238238
}
239239

240-
// replace current word in array with remainder
240+
// Replace current word in array with remainder
241241
var secondPart = word.substr(newWord.length);
242242

243243
words[j] = secondPart;
244244

245-
// append first piece to output
245+
// Append first piece to output
246246
out += newWord;
247247
}
248248

249-
// if existing word length is 0, don't include it
249+
// If existing word length is 0, don't include it
250250
var offset = (words[j].length) ? j : j + 1;
251251

252-
// collapse rest of sentence and remove any trailing white space
252+
// Collapse rest of sentence and remove any trailing white space
253253
var remainder = words.slice(offset).join(' ')
254254
.replace(/[ \n]*$/gi, '');
255255

256-
// prepend remainder to next line
256+
// Prepend remainder to next line
257257
lines[i + 1] = remainder + ' ' + (lines[i + 1] || '');
258258
linesCount = lines.length;
259259

260-
break; // processing on this line
260+
break; // Processing on this line
261261

262-
// append word with space to output
262+
// Append word with space to output
263263
}
264264
else
265265
{
@@ -268,11 +268,11 @@ var Text = new Class({
268268
}
269269
}
270270

271-
// append processed line to output
271+
// Append processed line to output
272272
output += out.replace(/[ \n]*$/gi, '') + '\n';
273273
}
274274

275-
// trim the end of the string
275+
// Trim the end of the string
276276
output = output.replace(/[\s|\n]*$/gi, '');
277277

278278
return output;

0 commit comments

Comments
 (0)