fixes for html5
This commit is contained in:
@@ -34,7 +34,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
layoutVAlign = VAlign.NONE;
|
layoutVAlign = VAlign.NONE;
|
||||||
textField = buildTextField();
|
textField = buildTextField();
|
||||||
textField.width = 1;
|
textField.width = 1;
|
||||||
textField.height = #if html5 25 #else 1 #end;
|
textField.height = 1;
|
||||||
textField.wordWrap = true;
|
textField.wordWrap = true;
|
||||||
textFormat = textField.defaultTextFormat;
|
textFormat = textField.defaultTextFormat;
|
||||||
textFormat.font = "Arial";
|
textFormat.font = "Arial";
|
||||||
@@ -93,11 +93,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
private function set_align(value:TextFormatAlign):TextFormatAlign {
|
private function set_align(value:TextFormatAlign):TextFormatAlign {
|
||||||
if (align != value) {
|
if (align != value) {
|
||||||
align = value;
|
align = value;
|
||||||
#if (flash || html5)
|
|
||||||
textFormat.align = value;
|
textFormat.align = value;
|
||||||
#else
|
|
||||||
textFormat.align = Std.string(value);
|
|
||||||
#end
|
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
return align;
|
return align;
|
||||||
@@ -148,6 +144,7 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
textField.autoSize = fill ? TextFieldAutoSize.NONE : TextFieldAutoSize.LEFT;
|
textField.autoSize = fill ? TextFieldAutoSize.NONE : TextFieldAutoSize.LEFT;
|
||||||
var t:String = currentText();
|
var t:String = currentText();
|
||||||
if (t != null) textField.text = t;
|
if (t != null) textField.text = t;
|
||||||
|
textField.setTextFormat(textFormat);
|
||||||
if (contentSize && !Std.is(skin, ISize)) {
|
if (contentSize && !Std.is(skin, ISize)) {
|
||||||
width = textField.width + paddings * 2;
|
width = textField.width + paddings * 2;
|
||||||
height = textField.height + paddings * 2;
|
height = textField.height + paddings * 2;
|
||||||
@@ -173,17 +170,20 @@ class TextView extends SpriteView implements ITextView<Sprite, TextField> {
|
|||||||
textField.x = paddings;
|
textField.x = paddings;
|
||||||
textField.y = paddings;
|
textField.y = paddings;
|
||||||
} else {
|
} else {
|
||||||
|
#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;
|
||||||
case HAlign.CENTER: (width - textField.width) / 2;
|
case HAlign.CENTER: (width - textField.width) / 2;
|
||||||
case HAlign.RIGHT: width - textField.width - paddings;
|
case HAlign.RIGHT: width - textField.width - paddings;
|
||||||
|
default: 0;
|
||||||
}
|
}
|
||||||
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.height) / 2;
|
||||||
case VAlign.BOTTOM: height - textField.height - paddings;
|
case VAlign.BOTTOM: height - textField.height - paddings;
|
||||||
|
default: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class DrawUtil {
|
|||||||
var m:Matrix = new Matrix();
|
var m:Matrix = new Matrix();
|
||||||
var sx:Float = 1.0;
|
var sx:Float = 1.0;
|
||||||
var sy:Float = 1.0;
|
var sy:Float = 1.0;
|
||||||
|
fillType = Type.createEnum(FillType, Std.string(fillType));
|
||||||
switch (fillType) {
|
switch (fillType) {
|
||||||
case FillType.REPEAT:
|
case FillType.REPEAT:
|
||||||
graphics.beginBitmapFill(image, m, true, false);
|
graphics.beginBitmapFill(image, m, true, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user