From 462ee023c397a6b266a23d46930aa4bc6a0e3452 Mon Sep 17 00:00:00 2001 From: shmyga Date: Thu, 25 Jun 2015 17:15:49 +0300 Subject: [PATCH] BitmapTextField fix --- haxework/gui/TextView.hx | 37 ++++++++++++-------------------- haxework/text/BitmapTextField.hx | 6 +++++- 2 files changed, 19 insertions(+), 24 deletions(-) mode change 100644 => 100755 haxework/text/BitmapTextField.hx diff --git a/haxework/gui/TextView.hx b/haxework/gui/TextView.hx index 7a7008c..7ea044c 100755 --- a/haxework/gui/TextView.hx +++ b/haxework/gui/TextView.hx @@ -201,32 +201,23 @@ class TextView extends SpriteView implements ITextView { } 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 { - textField.width = width; textField.height = _textHeight; - //#if html5 textField.height = _textHeight; #end - textField.x = switch (layoutHAlign) { - case HAlign.NONE: 0; - case HAlign.LEFT: leftPadding; - case HAlign.CENTER: (width - textField.width) / 2 + leftPadding - rightPadding; - case HAlign.RIGHT: width - textField.width - rightPadding; - default: 0; - } - textField.y = switch (layoutVAlign) { - case VAlign.NONE: 0; - case VAlign.TOP: topPadding; - case VAlign.MIDDLE: (height - _textHeight) / 2 + topPadding - bottomPadding; - case VAlign.BOTTOM: height - _textHeight - bottomPadding; - default: 0; - } - //} + textField.x = switch (layoutHAlign) { + case HAlign.NONE: 0; + case HAlign.LEFT: leftPadding; + case HAlign.CENTER: (width - textField.width) / 2 + leftPadding - rightPadding; + case HAlign.RIGHT: width - textField.width - rightPadding; + default: 0; + } + textField.y = switch (layoutVAlign) { + case VAlign.NONE: 0; + case VAlign.TOP: topPadding; + case VAlign.MIDDLE: (height - _textHeight) / 2 + topPadding - bottomPadding; + case VAlign.BOTTOM: height - _textHeight - bottomPadding; + default: 0; + } } override private function set_mouseEnabled(value:Bool):Bool { diff --git a/haxework/text/BitmapTextField.hx b/haxework/text/BitmapTextField.hx old mode 100644 new mode 100755 index add1e1b..8cd8147 --- a/haxework/text/BitmapTextField.hx +++ b/haxework/text/BitmapTextField.hx @@ -1,5 +1,6 @@ package haxework.text; +import haxe.Timer; import flash.text.TextFormat; import flash.events.Event; import flash.display.Bitmap; @@ -97,7 +98,10 @@ class BitmapTextField extends TextField { private function redraw() { var size = TextUtil.getSize(this); - bitmap.bitmapData = draw(this, size.x, size.y, shadowColor, shadowAlpha, shadow, stroke); + //ToDo: openfl 3.0.6 -> 3.1.0 + Timer.delay(function() { + bitmap.bitmapData = draw(this, size.x, size.y, shadowColor, shadowAlpha, shadow, stroke); + }, 1); bitmap.x = x; bitmap.y = y; _invalidated = false;