Fix scroller handling mouse click
This commit is contained in:
parent
a14f936cf0
commit
343a0aed78
1 changed files with 13 additions and 11 deletions
|
|
@ -107,26 +107,28 @@ namespace psemek::ui
|
||||||
if (e.button != mouse_button::left)
|
if (e.button != mouse_button::left)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
if (horizontal_scroll())
|
if (horizontal_scroll())
|
||||||
{
|
{
|
||||||
switch (horizontal_state_)
|
switch (horizontal_state_)
|
||||||
{
|
{
|
||||||
case state_t::normal:
|
case state_t::normal:
|
||||||
return false;
|
break;
|
||||||
case state_t::mouseover:
|
case state_t::mouseover:
|
||||||
if (e.down)
|
if (e.down)
|
||||||
{
|
{
|
||||||
horizontal_state_ = state_t::mousedown;
|
horizontal_state_ = state_t::mousedown;
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
return false;
|
break;
|
||||||
case state_t::mousedown:
|
case state_t::mousedown:
|
||||||
if (!e.down)
|
if (!e.down)
|
||||||
{
|
{
|
||||||
horizontal_state_ = state_t::mouseover;
|
horizontal_state_ = state_t::mouseover;
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,25 +137,25 @@ namespace psemek::ui
|
||||||
switch (vertical_state_)
|
switch (vertical_state_)
|
||||||
{
|
{
|
||||||
case state_t::normal:
|
case state_t::normal:
|
||||||
return false;
|
break;
|
||||||
case state_t::mouseover:
|
case state_t::mouseover:
|
||||||
if (e.down)
|
if (e.down)
|
||||||
{
|
{
|
||||||
vertical_state_ = state_t::mousedown;
|
vertical_state_ = state_t::mousedown;
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
return false;
|
break;
|
||||||
case state_t::mousedown:
|
case state_t::mousedown:
|
||||||
if (!e.down)
|
if (!e.down)
|
||||||
{
|
{
|
||||||
vertical_state_ = state_t::mouseover;
|
vertical_state_ = state_t::mouseover;
|
||||||
return true;
|
result = true;
|
||||||
}
|
}
|
||||||
return false;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool scroller::on_event(mouse_wheel const & e)
|
bool scroller::on_event(mouse_wheel const & e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue