fixes bug #4366 "Host screen menu allows clicking out of menu height"
also fixes a logical error in rects_overlap(r1, r2);
This commit is contained in:
parent
37edf14aa0
commit
18a51eb626
4 changed files with 7 additions and 4 deletions
|
@ -54,8 +54,8 @@ bool point_in_rect(int x, int y, const SDL_Rect& rect)
|
|||
|
||||
bool rects_overlap(const SDL_Rect& rect1, const SDL_Rect& rect2)
|
||||
{
|
||||
return point_in_rect(rect1.x,rect1.y,rect2) || point_in_rect(rect1.x+rect1.w,rect1.y,rect2) ||
|
||||
point_in_rect(rect1.x,rect1.y+rect1.h,rect2) || point_in_rect(rect1.x+rect1.w,rect1.y+rect1.h,rect2);
|
||||
return point_in_rect(rect1.x,rect1.y,rect2) || point_in_rect(rect2.x+rect2.w,rect2.y,rect1) ||
|
||||
point_in_rect(rect2.x,rect2.y+rect2.h,rect1) || point_in_rect(rect1.x+rect1.w,rect1.y+rect1.h,rect2);
|
||||
}
|
||||
|
||||
SDL_Rect intersect_rects(SDL_Rect const &rect1, SDL_Rect const &rect2)
|
||||
|
|
|
@ -121,7 +121,7 @@ void scrollpane::update_widget_positions()
|
|||
std::vector<bool> hidden(content_.size());
|
||||
int i = 0;
|
||||
for(itor = content_.begin(); itor != content_.end(); ++itor) {
|
||||
hidden[i++] = itor->second.w->hidden();
|
||||
hidden[i++] = (itor->second.w->state_ == HIDDEN);
|
||||
itor->second.w->hide();
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,8 @@ void widget::set_clip_rect(const SDL_Rect& rect)
|
|||
|
||||
bool widget::hidden() const
|
||||
{
|
||||
return state_ == HIDDEN || state_ == UNINIT;
|
||||
return (state_ == HIDDEN || state_ == UNINIT
|
||||
|| (clip_ && !rects_overlap(clip_rect_, rect_)));
|
||||
}
|
||||
|
||||
void widget::set_dirty(bool dirty)
|
||||
|
|
|
@ -110,6 +110,8 @@ private:
|
|||
std::string help_text_;
|
||||
int help_string_;
|
||||
ALIGN align_; //limited support, use position
|
||||
|
||||
friend class scrollpane;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue