mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-05-17 14:10:34 -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
2 changed files with 13 additions and 1 deletions
|
@ -95,7 +95,9 @@ void Widget::hidden(bool hide) {
|
||||||
|
|
||||||
// If parent is hidden, either of these is a no-op.
|
// If parent is hidden, either of these is a no-op.
|
||||||
if( hide ) {
|
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
|
/* TODO: Notify self and all non-hidden children that they're
|
||||||
* now effectively hidden?
|
* 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 ******************************************************************/
|
/* View ******************************************************************/
|
||||||
|
|
||||||
void View::set_parent_rect(const Rect new_parent_rect) {
|
void View::set_parent_rect(const Rect new_parent_rect) {
|
||||||
|
|
|
@ -131,6 +131,8 @@ protected:
|
||||||
.highlighted = false,
|
.highlighted = false,
|
||||||
.visible = false,
|
.visible = false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void dirty_overlapping_children_in_rect(const Rect& child_rect);
|
||||||
};
|
};
|
||||||
|
|
||||||
class View : public Widget {
|
class View : public Widget {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue