text view fix

This commit is contained in:
2015-05-25 14:47:47 +03:00
parent 28b94b7470
commit 1643283b5d
2 changed files with 7 additions and 3 deletions

View File

@@ -10,11 +10,13 @@ typedef Content = {
var x(default,default):Float;
var y(default,default):Float;
var visible(default,default):Bool;
var alpha(default,default):Float;
@:optional var mouseEnabled(default,default):Bool;
#else
var x(get,set):Float;
var y(get,set):Float;
var visible(get,set):Bool;
var alpha(get,set):Float;
@:optional var mouseEnabled(default,default):Bool;
#end
}

View File

@@ -12,6 +12,8 @@ import flash.text.TextField;
class TextView extends SpriteView implements ITextView<Sprite, TextField> {
private static var K_HEIGHT = 1.185;
public var textField(default, null):TextField;
public var text(get, set):String;
private var _text:String;
@@ -155,11 +157,11 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
if (t != null) for (i in 0...t.length) {
if (t.charCodeAt(i) == 10) s++;
}
_textHeight = textFormat.size * s;
_textHeight = (textFormat.size + 2) * s * K_HEIGHT;
_textWidth = width;
#else
_textWidth = textField.textWidth;
_textHeight = textField.textHeight;
_textHeight = textField.textHeight * K_HEIGHT;
#end
}
@@ -205,7 +207,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
//} else {
textField.width = width;
textField.height = _textHeight * 1.185;
textField.height = _textHeight;
//#if html5 textField.height = _textHeight; #end
textField.x = switch (layoutHAlign) {