Fixed hittest of Button meter due to lack of compatibility with new "Padding" option

This commit is contained in:
spx 2013-07-21 19:46:13 +09:00
parent 369f8c7082
commit 5f1d1c5888

View File

@ -229,11 +229,19 @@ bool MeterButton::HitTest2(int px, int py)
// Check transparent pixels // Check transparent pixels
if (m_Image.IsLoaded()) if (m_Image.IsLoaded())
{ {
Color color; Rect meterRect = GetMeterRectPadding();
Status status = m_Image.GetImage()->GetPixel(px - x + m_W * m_State, py - y, &color); int ix = meterRect.Width * m_State;
if (status != Ok || color.GetA() != 0) px = px - meterRect.X + ix;
py = py - meterRect.Y;
if (px >= ix && px < ix + meterRect.Width &&
py >= 0 && py < meterRect.Height)
{ {
return true; Color color;
Status status = m_Image.GetImage()->GetPixel(px, py, &color);
if (status != Ok || color.GetA() != 0)
{
return true;
}
} }
} }
else else