texview fixes

This commit is contained in:
2015-05-07 18:10:26 +03:00
parent a9886d8cc4
commit 256c3e0457

View File

@@ -30,11 +30,12 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
public function new() {
super();
layoutHAlign = HAlign.NONE;
layoutVAlign = VAlign.NONE;
layoutHAlign = HAlign.CENTER;
layoutVAlign = VAlign.MIDDLE;
textField = buildTextField();
textField.width = 1;
textField.height = 1;
textField.multiline = true;
textField.wordWrap = true;
//textField.borderColor = 0x00ff00;
//textField.border = true;
@@ -174,13 +175,17 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
}
private function placeTextField(textField:TextField):Void {
if (fill) {
textField.width = width - paddings * 2;
textField.height = height - paddings * 2;
textField.x = paddings;
textField.y = paddings;
} else {
#if html5 textField.height = textField.textHeight; #end
//if (fill) {
// textField.width = width - paddings * 2;
// textField.height = height - paddings * 2;
// textField.x = paddings;
// textField.y = paddings;
//} else {
textField.width = width;
textField.height = textField.textHeight * 1.185;
//#if html5 textField.height = textField.textHeight; #end
textField.x = switch (layoutHAlign) {
case HAlign.NONE: 0;
case HAlign.LEFT: paddings;
@@ -191,11 +196,11 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
textField.y = switch (layoutVAlign) {
case VAlign.NONE: 0;
case VAlign.TOP: paddings;
case VAlign.MIDDLE: (height - textField.height) / 2;
case VAlign.BOTTOM: height - textField.height - paddings;
case VAlign.MIDDLE: (height - textField.textHeight) / 2;
case VAlign.BOTTOM: height - textField.textHeight - paddings;
default: 0;
}
}
//}
}
override private function set_mouseEnabled(value:Bool):Bool {