Fix property value panel layout update.

This commit is contained in:
2022-11-15 12:06:00 +08:00
parent ea856f3339
commit 6444de41a2
2 changed files with 8 additions and 5 deletions

View File

@@ -24,10 +24,6 @@ namespace Cryville.Crtr.Browsing {
const float SPEED = 8; const float SPEED = 8;
float _ratio; float _ratio;
#pragma warning disable IDE0051 #pragma warning disable IDE0051
void Start() {
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
}
void Update() { void Update() {
if (_value && _ratio != 1) { if (_value && _ratio != 1) {
_ratio += SPEED * Time.deltaTime; _ratio += SPEED * Time.deltaTime;
@@ -40,6 +36,10 @@ namespace Cryville.Crtr.Browsing {
UpdateGraphics(); UpdateGraphics();
} }
} }
void OnRectTransformDimensionsChange() {
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
}
#pragma warning restore IDE0051 #pragma warning restore IDE0051
void UpdateGraphics() { void UpdateGraphics() {

View File

@@ -60,7 +60,6 @@ namespace Cryville.Crtr.Browsing {
ev.callback.AddListener(e => OnPointerClick((PointerEventData)e)); ev.callback.AddListener(e => OnPointerClick((PointerEventData)e));
m_ctn.triggers.Add(ev); m_ctn.triggers.Add(ev);
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
if (MaxStep != 0) SetRatio(0.5f); if (MaxStep != 0) SetRatio(0.5f);
} }
@@ -70,6 +69,10 @@ namespace Cryville.Crtr.Browsing {
SetValueFromPos(pp); SetValueFromPos(pp);
} }
} }
void OnRectTransformDimensionsChange() {
m_handleArea.sizeDelta = new Vector2(m_handle.rect.height - m_handle.rect.width, 0);
}
#pragma warning restore IDE0051 #pragma warning restore IDE0051
Vector2 pp; Vector2 pp;