Some fixes.

--HG--
branch : dev
This commit is contained in:
Martín Lucas Golini
2019-01-17 17:28:02 -03:00
parent 02c8afee20
commit 22b1d76c47
3 changed files with 12 additions and 4 deletions

View File

@@ -620,7 +620,13 @@ bool UITextView::setAttribute( const NodeAttribute& attribute, const Uint32& sta
}
setFontStyle( flags );
} else if ( "wordwrap" == name || "word_wrap" == name ) {
if ( attribute.asBool() )
mFlags |= UI_WORD_WRAP;
else
mFlags &= ~UI_WORD_WRAP;
autoShrink();
} else if ( "fontoutlinethickness" == name ) {
SAVE_NORMAL_STATE_ATTR( String::toStr( PixelDensity::dpToPx( getOutlineThickness() ) ) )

View File

@@ -699,7 +699,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( String::startsWith( attribute.getValue(), "#" ) ) {
setAttribute( NodeAttribute( "backgroundcolor", attribute.getValue() ) );
} else if ( NULL != ( res = DrawableSearcher::searchByName( name ) ) ) {
} else if ( NULL != ( res = DrawableSearcher::searchByName( attribute.getValue() ) ) ) {
setBackgroundDrawable( state, res, res->getDrawableType() == Drawable::SPRITE );
}
} else if ( "backgroundcolor" == name ) {
@@ -897,8 +897,6 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
notifyLayoutAttrChange();
} else if ( "clip" == cur ) {
clipEnable();
} else if ( "word_wrap" == cur || "wordwrap" == cur ) {
setFlags( UI_WORD_WRAP );
} else if ( "multi" == cur ) {
setFlags( UI_MULTI_SELECT );
} else if ( "auto_padding" == cur || "autopadding" == cur ) {

View File

@@ -32,12 +32,14 @@
namespace EE { namespace UI {
static bool sBaseListCreated = false;
UIWidgetCreator::WidgetCallbackMap UIWidgetCreator::widgetCallback = UIWidgetCreator::WidgetCallbackMap();
UIWidgetCreator::RegisteredWidgetCallbackMap UIWidgetCreator::registeredWidget = UIWidgetCreator::RegisteredWidgetCallbackMap();
void UIWidgetCreator::createBaseWidgetList() {
if ( registeredWidget.empty() ) {
if ( !sBaseListCreated ) {
registeredWidget["widget"] = UIWidget::New;
registeredWidget["linearlayout"] = UILinearLayout::NewVertical;
registeredWidget["relativelayout"] = UIRelativeLayout::New;
@@ -75,6 +77,8 @@ void UIWidgetCreator::createBaseWidgetList() {
registeredWidget["vbox"] = UILinearLayout::NewVertical;
registeredWidget["input"] = UITextInput::New;
registeredWidget["inputpassword"] = UITextInputPassword::New;
sBaseListCreated = true;
}
}