mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 18:45:54 -05:00
Draging scroll bars with mouse now behaves more properly.
This commit is contained in:
parent
f448f18ae4
commit
815312466c
1 changed files with 4 additions and 1 deletions
|
@ -959,7 +959,10 @@ struct Imgui
|
||||||
{
|
{
|
||||||
const int32_t diff = height - sh;
|
const int32_t diff = height - sh;
|
||||||
|
|
||||||
const int32_t val = *area.m_scrollVal - (m_my - m_dragY);
|
const int32_t drag = m_my - m_dragY;
|
||||||
|
const float dragFactor = float(sh)/float(height);
|
||||||
|
|
||||||
|
const int32_t val = *area.m_scrollVal - int32_t(drag*dragFactor);
|
||||||
const int32_t min = (diff < 0) ? diff : *area.m_scrollVal;
|
const int32_t min = (diff < 0) ? diff : *area.m_scrollVal;
|
||||||
const int32_t max = 0;
|
const int32_t max = 0;
|
||||||
*area.m_scrollVal = IMGUI_CLAMP(val, min, max);
|
*area.m_scrollVal = IMGUI_CLAMP(val, min, max);
|
||||||
|
|
Loading…
Reference in a new issue