[view] fixes

This commit is contained in:
2019-07-12 21:15:01 +03:00
parent b9908f2d5b
commit 6274bd271e
9 changed files with 38 additions and 20 deletions

View File

@@ -18,6 +18,7 @@ class LabelListItem<T> extends LabelView implements IListItemView<T> {
public function new(formatter:Formatter<T> = null) {
super();
textField.wordWrap = true;
this.formatter = formatter == null ? defaultFormatter : formatter;
geometry.width.percent = 100;
geometry.height.fixed = 20;

View File

@@ -18,5 +18,7 @@ class TabColorSkin extends ButtonColorSkin {
graphics.beginFill(color, 1.0);
graphics.lineStyle(2, ColorUtil.multiply(color, 1.5));
graphics.drawRoundRectComplex(1, 1, view.width - 2, view.height - 2, 5, 5, 0, 0);
graphics.lineStyle();
graphics.endFill();
}
}

View File

@@ -18,6 +18,6 @@ class FontPreset {
this.color = color != null ? color : 0xffffff;
this.size = size;
this.bold = bold;
this.align = align;
this.align = align != null ? align : TextFormatAlign.LEFT;
}
}

View File

@@ -31,8 +31,8 @@ class TextView extends SpriteView implements ITextView {
style = "text";
layout = new Layout();
textField = buildTextField();
textField.width = 1;
textField.height = 1;
textField.width = 100;
textField.height = 100;
textField.multiline = true;
textField.wordWrap = true;
#if dev_layout
@@ -77,13 +77,21 @@ class TextView extends SpriteView implements ITextView {
private function updateTextSize():Void {
var size = TextUtil.getSize(textField);
if (!Math.isNaN(size.x) && !Math.isNaN(size.y)/* && size.x > 0 && size.y > 0*/) {
setSize(size.x, size.y, "text");
setSize(textField.wordWrap ? 0 : size.x, size.y, "text");
}
}
override public function update():Void {
//Kludge
if (textField.wordWrap && width - geometry.padding.horizontal == 0) {
return;
}
textField.embedFonts = font.embed;
textField.defaultTextFormat = new TextFormat(font.family, font.size, font.color, font.bold);
textField.defaultTextFormat = new TextFormat(
font.family, font.size, font.color,
font.bold, false, false, null,
font.align
);
textField.autoSize = fill ? TextFieldAutoSize.NONE : TextFieldAutoSize.LEFT;
var t:String = currentText();
if (t != null) textField.text = t;
@@ -102,7 +110,8 @@ class TextView extends SpriteView implements ITextView {
private function placeTextField(textField:TextField):Void {
textField.width = width;
textField.height = height; // ToDo:
textField.height = sizeSet.exists("text") ? sizeSet.get("text").height : height;
//textField.height = height;
textField.x = switch (layout.hAlign) {
case LEFT | NONE: geometry.padding.left;