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