Skip to content

Commit

Permalink
cla-116: fix for action blocked when click_count was > 1· (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebasconp authored Dec 2, 2024
1 parent b2276b9 commit af704d6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions code/classeine-lib/clsn/ui/clickable_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ namespace clsn::ui

void clickable_control::process_mouse_click_event(events::mouse_click_event& e)
{
m_pressed = e.is_button_pressed() && e.is_one_left_click();
const bool left_click = e.is_left_click();
m_pressed = e.is_button_pressed() && left_click;
this->invalidate();

if (!m_pressed && e.is_one_left_click())
if (!m_pressed && left_click)
{
perform_click();
}
Expand Down
4 changes: 2 additions & 2 deletions code/classeine-lib/clsn/ui/events/mouse_click_event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ namespace clsn::ui::events
return m_button_id;
}

auto mouse_click_event::is_one_left_click() const noexcept -> bool
auto mouse_click_event::is_left_click() const noexcept -> bool
{
return m_button_id == 1 && m_click_count == 1;
return m_button_id == 1;
}

auto mouse_click_event::is_button_pressed() const noexcept -> bool
Expand Down
2 changes: 1 addition & 1 deletion code/classeine-lib/clsn/ui/events/mouse_click_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace clsn::ui::events
[[nodiscard]] auto get_click_count() const noexcept -> int;
[[nodiscard]] auto get_button_id() const noexcept -> int;

[[nodiscard]] auto is_one_left_click() const noexcept -> bool;
[[nodiscard]] auto is_left_click() const noexcept -> bool;
[[nodiscard]] auto is_button_pressed() const noexcept -> bool;
};
}

0 comments on commit af704d6

Please sign in to comment.