Fix default ui::window impl event handling
This commit is contained in:
parent
1c9fb28ebf
commit
9ab72a7c1a
1 changed files with 18 additions and 4 deletions
|
|
@ -311,17 +311,31 @@ namespace psemek::ui
|
||||||
|
|
||||||
bool on_event(mouse_click const & e) override
|
bool on_event(mouse_click const & e) override
|
||||||
{
|
{
|
||||||
if (!mouse_ || !shape().contains(geom::cast<float>(*mouse_)))
|
if (!mouse_)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (e.button == mouse_button::left && mouse_)
|
if (e.button == mouse_button::left && mouse_)
|
||||||
{
|
{
|
||||||
if (e.down)
|
if (e.down && shape().contains(geom::cast<float>(*mouse_)))
|
||||||
|
{
|
||||||
drag_ = *mouse_;
|
drag_ = *mouse_;
|
||||||
else
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!e.down && drag_)
|
||||||
|
{
|
||||||
drag_ = std::nullopt;
|
drag_ = std::nullopt;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
if (e.button == mouse_button::left && mouse_)
|
||||||
|
{
|
||||||
|
if (shape().contains(geom::cast<float>(*mouse_)))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool on_event(mouse_wheel const &) override
|
bool on_event(mouse_wheel const &) override
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue