change name of box.contains_point and contains_box

This commit is contained in:
hippoz 2022-10-16 14:38:06 +03:00
parent 7cd8169622
commit 9ef5cbab9b
No known key found for this signature in database
GPG key ID: 7C52899193467641
4 changed files with 10 additions and 10 deletions

View file

@ -13,15 +13,15 @@ Box Box::offset(double x, double y) {
};
}
bool Box::contains_point(double x, double y) const {
bool Box::contains(double x, double y) const {
return x >= m_x && m_x + m_width >= x && y >= m_y && m_y + m_height >= y;
}
bool Box::contains_point(const Point &point) const {
bool Box::contains(const Point &point) const {
return point.x() >= m_x && m_x + m_width >= point.x() && point.y() >= m_y && m_y + m_height >= point.y();
}
bool Box::contains_box(const Box &other) const {
bool Box::contains(const Box &other) const {
double ax1 = m_x;
double ax2 = m_x + m_width;
double ay1 = m_y;

View file

@ -78,9 +78,9 @@ public:
void update();
bool contains_point(double x, double y) const;
bool contains_point(const Point &point) const;
bool contains_box(const Box &other) const;
bool contains(double x, double y) const;
bool contains(const Point &point) const;
bool contains(const Box &other) const;
Box offset(double x, double y);
Box united(const Box &other);

View file

@ -26,7 +26,7 @@ void ListView::set_active_element(unsigned int active_element) {
}
void ListView::on_mouse_button(MouseButtonEvent &event) {
if (!rect().contains_point(event.point())) {
if (!rect().contains(event.point())) {
return;
}

View file

@ -134,7 +134,7 @@ void Widget::handle_repaint_rect(RepaintRectEvent &event) {
if (!m_did_init || !painter.can_paint())
return;
if (!event.box().contains_box(m_rect))
if (!event.box().contains(m_rect))
return; // widgets contain their children, thus we don't need to recurse further
// using a "group" in cairo reduces flickering
@ -209,7 +209,7 @@ void Widget::handle_relayout_subtree(RelayoutSubtreeEvent &event) {
void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
bool update_focus_to = true;
if (!m_rect.contains_point(event.point())) {
if (!m_rect.contains(event.point())) {
// we just became unfocused
update_focus_to = false;
}
@ -244,7 +244,7 @@ void Widget::handle_mouse_move_event(MouseMoveEvent &event) {
void Widget::handle_mouse_button_event(MouseButtonEvent &event) {
bool update_activation_to = event.was_left_button_pressed();
if (!m_rect.contains_point(event.point())) {
if (!m_rect.contains(event.point())) {
update_activation_to = false;
}