Fix tab not expanded correctly while inner elements are resizing.
This commit is contained in:
@@ -54,11 +54,22 @@ namespace Cryville.Crtr.Browsing.UI {
|
||||
[SerializeField]
|
||||
float m_tweenDuration = 0.2f;
|
||||
|
||||
float _lastWidth;
|
||||
bool _delayedUpdate;
|
||||
PropertyTweener<float> _tweener;
|
||||
void UpdateTweener() {
|
||||
_tweener.Start(GetTargetLayoutMinWidth(), m_tweenDuration);
|
||||
var width = GetTargetLayoutMinWidth();
|
||||
_tweener.Start(width, m_tweenDuration);
|
||||
if (width != _lastWidth) {
|
||||
_lastWidth = width;
|
||||
_delayedUpdate = true;
|
||||
}
|
||||
}
|
||||
void Update() {
|
||||
if (_delayedUpdate) {
|
||||
_delayedUpdate = false;
|
||||
UpdateTweener();
|
||||
}
|
||||
_tweener.Advance(Time.deltaTime);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user