mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Fix flickering freq/gain options views.
Was caused by invalidating ALL of the parent view, when only the overlapping views would need to be repainted.
This commit is contained in:
parent
b801366e4e
commit
275b644edd
@ -95,7 +95,9 @@ void Widget::hidden(bool hide) {
|
||||
|
||||
// If parent is hidden, either of these is a no-op.
|
||||
if( hide ) {
|
||||
parent()->set_dirty();
|
||||
// TODO: Instead of dirtying parent entirely, dirty only children
|
||||
// that overlap with this widget.
|
||||
parent()->dirty_overlapping_children_in_rect(parent_rect);
|
||||
/* TODO: Notify self and all non-hidden children that they're
|
||||
* now effectively hidden?
|
||||
*/
|
||||
@ -198,6 +200,14 @@ void Widget::visible(bool v) {
|
||||
}
|
||||
}
|
||||
|
||||
void Widget::dirty_overlapping_children_in_rect(const Rect& child_rect) {
|
||||
for(auto child : children()) {
|
||||
if( !child_rect.intersect(child->parent_rect).is_empty() ) {
|
||||
child->set_dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* View ******************************************************************/
|
||||
|
||||
void View::set_parent_rect(const Rect new_parent_rect) {
|
||||
|
@ -131,6 +131,8 @@ protected:
|
||||
.highlighted = false,
|
||||
.visible = false,
|
||||
};
|
||||
|
||||
void dirty_overlapping_children_in_rect(const Rect& child_rect);
|
||||
};
|
||||
|
||||
class View : public Widget {
|
||||
|
Loading…
Reference in New Issue
Block a user