mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-13 04:42:12 +03:00
UILoader padding.
--HG-- branch : dev-widget-padding
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
<TextView layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" padding="12dp" backgroundColor="#242424" layout_gravity="top|right" layout_margin="12dp" />
|
||||
<TextView id="tm" layout_width="wrap_content" layout_height="wrap_content" text="testing margin" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|left" layout_margin="12dp" />
|
||||
<TextView id="tmp" layout_width="wrap_content" layout_height="wrap_content" text="testing margin padding" textSize="24dp" backgroundColor="#242424" layout_gravity="bottom|right" layout_margin="12dp" padding="12dp" />
|
||||
<Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fillColor="#999" />
|
||||
<Loader layout_width="350dp" layout_height="350dp" layout_gravity="center" fillColor="#999" padding="44dp" outlinethickness="8dp" />
|
||||
|
||||
<Sprite layout_width="96dp" layout_height="96dp" src="bn" padding="8dp" backgroundColor="#888" gravity="center" layout_marginTop="56dp" gravity="right|bottom" />
|
||||
<TextureRegion layout_width="96dp" layout_height="96dp" src="bn01" padding="8dp" backgroundColor="#787" gravity="center" layout_marginTop="162dp" gravity="right|bottom" />
|
||||
|
||||
@@ -68,7 +68,11 @@ class EE_API UILoader : public UIWidget {
|
||||
IntPtr mOp;
|
||||
bool mIndeterminate;
|
||||
|
||||
virtual void onAutoSize();
|
||||
|
||||
virtual void onSizeChange();
|
||||
|
||||
virtual void onPaddingChange();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -63,8 +63,10 @@ void UILoader::update( const Time& time ) {
|
||||
|
||||
if ( mOp == 1 && mArcAngle > 340 ) {
|
||||
mOp = -1;
|
||||
mArcAngle = 340;
|
||||
} else if ( mOp == -1 && mArcAngle < 20 ) {
|
||||
mOp = 1;
|
||||
mArcAngle = 20;
|
||||
}
|
||||
|
||||
mArc.setArcAngle( mArcAngle );
|
||||
@@ -110,7 +112,33 @@ const Color& UILoader::getFillColor() const {
|
||||
|
||||
void UILoader::onSizeChange() {
|
||||
if ( mRadius == 0 ) {
|
||||
setRadius( eemin( mDpSize.x, mDpSize.y ) / 2.f );
|
||||
setRadius( eemin( mDpSize.x - mPadding.Left - mPadding.Right, mDpSize.y - mPadding.Top - mPadding.Bottom ) / 2.f );
|
||||
}
|
||||
}
|
||||
|
||||
void UILoader::onPaddingChange() {
|
||||
mRadius = 0;
|
||||
|
||||
onSizeChange();
|
||||
|
||||
UIWidget::onPaddingChange();
|
||||
}
|
||||
|
||||
void UILoader::onAutoSize() {
|
||||
if ( mLayoutWidthRules == WRAP_CONTENT || mLayoutHeightRules == WRAP_CONTENT ) {
|
||||
Sizef minSize( mDpSize );
|
||||
|
||||
if ( mLayoutWidthRules == WRAP_CONTENT ) {
|
||||
minSize.x = eemax( minSize.x, 64.f );
|
||||
}
|
||||
|
||||
if ( mLayoutHeightRules == WRAP_CONTENT ) {
|
||||
minSize.y = eemax( minSize.y, 64.f );
|
||||
}
|
||||
|
||||
setSize( minSize );
|
||||
|
||||
onSizeChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user