mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(ui): handle HitRectInsets in CSimpleFrame::LoadXML
This commit is contained in:
parent
3dc6b4373e
commit
45838c6897
@ -265,7 +265,11 @@ void CSimpleFrame::LoadXML(XMLNode* node, CStatus* status) {
|
||||
}
|
||||
|
||||
if (!SStrCmpI(child->GetName(), "HitRectInsets", 0x7FFFFFFFu)) {
|
||||
// TODO
|
||||
float left, right, top, bottom;
|
||||
|
||||
if (LoadXML_Insets(child, left, right, top, bottom, status)) {
|
||||
this->SetHitRectInsets(left, right, top, bottom);
|
||||
}
|
||||
}
|
||||
|
||||
if (!SStrCmpI(child->GetName(), "Layers", 0x7FFFFFFFu)) {
|
||||
@ -1419,6 +1423,18 @@ void CSimpleFrame::SetHitRect() {
|
||||
this->m_hitRect.maxY = this->m_rect.maxY - this->m_hitOffset.maxY * this->m_layoutScale;
|
||||
}
|
||||
|
||||
void CSimpleFrame::SetHitRectInsets(float left, float right, float top, float bottom) {
|
||||
this->m_hitOffset.minX = left;
|
||||
this->m_hitOffset.maxX = right;
|
||||
this->m_hitOffset.maxY = top;
|
||||
this->m_hitOffset.minY = bottom;
|
||||
|
||||
this->m_hitRect.minX = this->m_rect.minX + (left * this->m_layoutScale);
|
||||
this->m_hitRect.maxX = this->m_rect.maxX - (right * this->m_layoutScale);
|
||||
this->m_hitRect.maxY = this->m_rect.maxY - (top * this->m_layoutScale);
|
||||
this->m_hitRect.minY = this->m_rect.minY + (bottom * this->m_layoutScale);
|
||||
}
|
||||
|
||||
void CSimpleFrame::SetParent(CSimpleFrame* parent) {
|
||||
if (this->m_parent == parent) {
|
||||
return;
|
||||
|
||||
@ -159,6 +159,7 @@ class CSimpleFrame : public CScriptRegion {
|
||||
bool SetFrameScale(float scale, bool force);
|
||||
void SetFrameStrata(FRAME_STRATA strata);
|
||||
void SetHitRect();
|
||||
void SetHitRectInsets(float left, float right, float top, float bottom);
|
||||
void SetParent(CSimpleFrame* parent);
|
||||
void Show();
|
||||
int32_t TestHitRect(const C2Vector& pt);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user