Fix tab not expanded correctly while inner elements are resizing.

This commit is contained in:
2023-11-30 17:01:43 +08:00
parent ea3ca7806c
commit 5d884c1c7b

View File

@@ -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);
}