fixes for html5

This commit is contained in:
2015-04-24 14:24:04 +03:00
parent f7eaa313e7
commit 2e6dbb7b38
2 changed files with 6 additions and 5 deletions

View File

@@ -34,7 +34,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
layoutVAlign = VAlign.NONE;
textField = buildTextField();
textField.width = 1;
textField.height = #if html5 25 #else 1 #end;
textField.height = 1;
textField.wordWrap = true;
textFormat = textField.defaultTextFormat;
textFormat.font = "Arial";
@@ -93,11 +93,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
private function set_align(value:TextFormatAlign):TextFormatAlign {
if (align != value) {
align = value;
#if (flash || html5)
textFormat.align = value;
#else
textFormat.align = Std.string(value);
#end
invalidate();
}
return align;
@@ -148,6 +144,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
textField.autoSize = fill ? TextFieldAutoSize.NONE : TextFieldAutoSize.LEFT;
var t:String = currentText();
if (t != null) textField.text = t;
textField.setTextFormat(textFormat);
if (contentSize && !Std.is(skin, ISize)) {
width = textField.width + paddings * 2;
height = textField.height + paddings * 2;
@@ -173,17 +170,20 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
textField.x = paddings;
textField.y = paddings;
} else {
#if html5 textField.height = textField.textHeight; #end
textField.x = switch (layoutHAlign) {
case HAlign.NONE: 0;
case HAlign.LEFT: paddings;
case HAlign.CENTER: (width - textField.width) / 2;
case HAlign.RIGHT: width - textField.width - paddings;
default: 0;
}
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;
default: 0;
}
}
}

View File

@@ -31,6 +31,7 @@ class DrawUtil {
var m:Matrix = new Matrix();
var sx:Float = 1.0;
var sy:Float = 1.0;
fillType = Type.createEnum(FillType, Std.string(fillType));
switch (fillType) {
case FillType.REPEAT:
graphics.beginBitmapFill(image, m, true, false);