Minor clean up.

--HG--
branch : dev
This commit is contained in:
Martí­n Lucas Golini
2019-11-24 15:17:14 -03:00
parent ec4914a411
commit 182b83feb8
7 changed files with 42 additions and 13 deletions

View File

@@ -320,6 +320,18 @@ TabWidget {
background-position: bottom right;
}
#lvbox {
background-image: url(file://assets/icon/ee.png);
background-position: bottom right;
background-size: 128px 128px;
transition: all 1s;
clip: true;
}
#lvbox:hover {
background-position: top right;
}
#rrl > #tmap {
font-size: 24dp;
padding: 12dp;

View File

@@ -96,6 +96,8 @@ class Vector2 {
Vector2<T> floor();
Vector2<T> abs();
Vector2<Float> asFloat();
Vector2<int> asInt();
@@ -433,6 +435,10 @@ Vector2<T> Vector2<T>::floor() {
return Vector2<T>( eefloor( x ), eefloor( y ) );
}
template <typename T>
Vector2<T> Vector2<T>::abs() {
return Vector2<T>( eeabs( x ), eeabs( y ) );
}
template <typename T>
Vector2<Float> Vector2<T>::asFloat() {

View File

@@ -36,6 +36,8 @@ class StyleSheetLength {
StyleSheetLength();
StyleSheetLength( std::string val, const Float& defaultValue = 0 );
StyleSheetLength( const StyleSheetLength& val );
void setValue( const Float& val, const Unit& units );

View File

@@ -86,6 +86,8 @@ class EE_API UINodeDrawable : public Drawable {
const Vector2f& getOffset() const;
std::string getOffsetEq();
void setPositionEq( const std::string& offset );
const std::string& getPositionEq() const { return mPositionEq; }
@@ -111,7 +113,6 @@ class EE_API UINodeDrawable : public Drawable {
MoveAction * getMoveAction() const;
void setMoveAction(MoveAction * moveAction);
protected:
UINodeDrawable * mContainer;
Sizef mSize;

View File

@@ -35,6 +35,10 @@ StyleSheetLength::StyleSheetLength() :
mValue(0)
{}
StyleSheetLength::StyleSheetLength( std::string val, const Float& defaultValue ) :
StyleSheetLength( fromString( val, defaultValue ) ) {
}
StyleSheetLength::StyleSheetLength(const StyleSheetLength& val) {
mUnit = val.mUnit;
mValue = val.mValue;

View File

@@ -371,18 +371,18 @@ Sizef UINodeDrawable::LayerDrawable::calcDrawableSize( const std::string& drawab
size = mDrawable->getSize();
}
} else if ( sizePart[0] != "auto" ) {
CSS::StyleSheetLength wl( CSS::StyleSheetLength::fromString( sizePart[0] ) );
CSS::StyleSheetLength wl( sizePart[0] );
size.x = mContainer->getOwner()->lengthAsPixels( wl, Sizef::Zero, true );
if ( sizePart[1] == "auto" ) {
Sizef drawableSize( mDrawable->getSize() );
size.y = drawableSize.getHeight() * ( size.getWidth() / drawableSize.getWidth() );
} else {
CSS::StyleSheetLength hl( CSS::StyleSheetLength::fromString( sizePart[1] ) );
CSS::StyleSheetLength hl( sizePart[1] );
size.y = mContainer->getOwner()->lengthAsPixels( hl, Sizef::Zero, false );
}
} else {
CSS::StyleSheetLength hl( CSS::StyleSheetLength::fromString( sizePart[1] ) );
CSS::StyleSheetLength hl( sizePart[1] );
size.y = mContainer->getOwner()->lengthAsPixels( hl, Sizef::Zero, false );
Sizef drawableSize( mDrawable->getSize() );
@@ -410,8 +410,8 @@ Vector2f UINodeDrawable::LayerDrawable::calcPosition( const std::string& positio
yFloatIndex = 0;
}
CSS::StyleSheetLength xl( CSS::StyleSheetLength::fromString( pos[xFloatIndex] ) );
CSS::StyleSheetLength yl( CSS::StyleSheetLength::fromString( pos[yFloatIndex] ) );
CSS::StyleSheetLength xl( pos[xFloatIndex] );
CSS::StyleSheetLength yl( pos[yFloatIndex] );
position.x = mContainer->getOwner()->lengthAsPixels( xl, mDrawableSize, true );
position.y = mContainer->getOwner()->lengthAsPixels( yl, mDrawableSize, false );
} else if ( pos.size() > 2 ) {
@@ -427,10 +427,10 @@ Vector2f UINodeDrawable::LayerDrawable::calcPosition( const std::string& positio
yFloatIndex = 0;
}
CSS::StyleSheetLength xl1( CSS::StyleSheetLength::fromString( pos[xFloatIndex] ) );
CSS::StyleSheetLength xl2( CSS::StyleSheetLength::fromString( pos[xFloatIndex+1] ) );
CSS::StyleSheetLength yl1( CSS::StyleSheetLength::fromString( pos[yFloatIndex] ) );
CSS::StyleSheetLength yl2( CSS::StyleSheetLength::fromString( pos[yFloatIndex+1] ) );
CSS::StyleSheetLength xl1( pos[xFloatIndex] );
CSS::StyleSheetLength xl2( pos[xFloatIndex+1] );
CSS::StyleSheetLength yl1( pos[yFloatIndex] );
CSS::StyleSheetLength yl2( pos[yFloatIndex+1] );
position.x = mContainer->getOwner()->lengthAsPixels( xl1, mDrawableSize, true );
@@ -465,6 +465,10 @@ void UINodeDrawable::LayerDrawable::setOffset( const Vector2f& offset ) {
mOffset = offset;
}
std::string UINodeDrawable::LayerDrawable::getOffsetEq() {
return String::format( "%.fpx %.fpx", mOffset.x, mOffset.y );
}
void UINodeDrawable::LayerDrawable::onPositionChange() {
invalidate();
}

View File

@@ -887,7 +887,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) {
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( attribute.getName() ) );
Uint32 tag = String::hash("width");
constexpr Uint32 tag = String::hash("width");
Action * action = Actions::ResizeWidth::New( getSize().getWidth(), newWidth, transitionInfo.duration, transitionInfo.timingFunction );
@@ -909,7 +909,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
Float newHeight = attribute.asDpDimensionI();
if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) {
Uint32 tag = String::hash("height");
constexpr Uint32 tag = String::hash("height");
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( attribute.getName() ) );
Action * action = Actions::ResizeHeight::New( getSize().getHeight(), newHeight, transitionInfo.duration, transitionInfo.timingFunction );
@@ -956,7 +956,7 @@ bool UIWidget::setAttribute( const NodeAttribute& attribute, const Uint32& state
SAVE_NORMAL_STATE_ATTR( getBackground()->getLayer(0)->getPositionEq() );
/*if ( !isSceneNodeLoading() && NULL != mStyle && mStyle->hasTransition( attribute.getName() ) ) {
Uint32 tag = String::hash( "background-position" );
constexpr Uint32 tag = String::hash( "background-position" );
UIStyle::TransitionInfo transitionInfo( mStyle->getTransition( attribute.getName() ) );