Skip to content

Commit f6aacb2

Browse files
committed
Minor renaming for readability
1 parent 0b13c29 commit f6aacb2

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/Character.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,16 @@ export default class Character extends createjs.Shape {
109109
(this._font.ascent - this._font.descent) * this.scaleX;
110110
this.measuredWidth = this.scaleX * this._glyph.offset * this._font.units;
111111

112-
const ha = new createjs.Shape();
113-
ha.graphics
112+
const hitArea = new createjs.Shape();
113+
hitArea.graphics
114114
.beginFill("#000")
115115
.drawRect(
116116
0,
117117
this._font.descent,
118118
this._glyph.offset * this._font.units,
119119
this._font.ascent - this._font.descent
120120
);
121-
this.hitArea = ha;
121+
this.hitArea = hitArea;
122122

123123
this._glyph.boundingLine();
124124
}

src/CharacterText.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ export default class CharacterText extends TextContainer {
300300
*/
301301
characterLayout(): boolean {
302302
//char layout
303-
const len = this.text.length;
304303
let char: Character;
305304
const defaultStyle: Style = {
306305
size: this.size,
@@ -322,9 +321,9 @@ export default class CharacterText extends TextContainer {
322321
this.lines.push(currentLine);
323322
this.block.addChild(currentLine);
324323

325-
// loop over characters
326-
// place into lines
327-
for (let i = 0; i < len; i++) {
324+
// loop over characters, and place into lines
325+
for (let i = 0; i < this.text.length; i++) {
326+
// apply custom character styles
328327
if (this.style !== null && this.style[i] !== undefined) {
329328
currentStyle = this.style[i];
330329
// make sure style contains properties needed.
@@ -350,7 +349,7 @@ export default class CharacterText extends TextContainer {
350349
// new line has no character
351350
if (this.text.charAt(i) == "\n" || this.text.charAt(i) == "\r") {
352351
//only if not last char
353-
if (i < len - 1) {
352+
if (i < this.text.length - 1) {
354353
if (firstLine === true) {
355354
vPosition = currentStyle.size;
356355
currentLine.measuredHeight = currentStyle.size;

0 commit comments

Comments
 (0)