mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Fixing imgui mouse scroll.
This commit is contained in:
parent
fd2fbc6a8b
commit
8e578b3d37
1 changed files with 16 additions and 16 deletions
|
@ -911,14 +911,23 @@ 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
|
||||
{
|
||||
*area.m_scrollVal = 0;
|
||||
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;
|
||||
|
|
Loading…
Reference in a new issue