Merge pull request #179 from dariomanesku/master

Fixing imgui mouse scroll.
This commit is contained in:
Branimir Karadžić 2014-11-14 08:31:36 -08:00
commit bb1fd097ad

View File

@ -911,15 +911,24 @@ struct Imgui
const float barHeight = (float)height / (float)sh;
const int32_t diff = height - sh;
if (diff < 0)
// Handle mouse scrolling.
if (area.m_inside && !anyActive() )
{
*area.m_scrollVal = (*area.m_scrollVal > diff) ? *area.m_scrollVal : diff;
}
else
const int32_t min = height - sh;
if (min > 0)
{
*area.m_scrollVal = 0;
}
else if (m_scroll)
{
const int32_t val = *area.m_scrollVal + 20*m_scroll;
const int32_t max = 0;
*area.m_scrollVal = ( val > max ? max
: val < min ? min
: val
);
}
}
if (barHeight < 1.0f)
{
@ -1017,15 +1026,6 @@ struct Imgui
);
}
}
// Handle mouse scrolling.
if (area.m_inside) // && !anyActive() )
{
if (m_scroll)
{
*area.m_scrollVal += bx::uint32_clamp(20 * m_scroll, 0, sh - height);
}
}
}
area.m_inside = false;