widget gallery and compositor test bench
Update widget event propagation skips to support ControlPanel scrolling and clipping
src/main.rs | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/src/main.rs b/src/main.rs
index 1b22f9b..aeb886b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -637,6 +637,9 @@ cascades in cce."
if i == 50 {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
let (wx, wy, ww, wh) = w.rect();
let has_rounded = w.rounded_corners() != (false, false, false, false);
@@ -969,6 +972,9 @@ cascades in cce."
if !self.is_widget_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.popover_rect().is_some() {
w.render_popover(&mut popover_pc);
}
@@ -1082,6 +1088,9 @@ cascades in cce."
if !is_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
let widget_font_opt = w.widget_font();
for (label, font, bounds) in w.text_labels_with_font_and_bounds(&self.ui_context) {
let active_font = font.or_else(|| widget_font_opt.clone());
@@ -1129,6 +1138,9 @@ cascades in cce."
if !is_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.popover_rect().is_some() {
w.render_popover(&mut popover_pc);
}
@@ -1307,6 +1319,9 @@ cascades in cce."
};
for (i, w) in self.widgets.iter_mut().enumerate() {
if is_visible(i) {
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.tick(dt, &mut self.ui_context) {
changed = true;
if self.is_child && self.child_type.as_deref() == Some("Ramp") && i == 1 {
@@ -1712,6 +1727,9 @@ impl PointerHandler for AppState {
if !is_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.cursor_moved(state.cursor_x, state.cursor_y, &mut state.ui_context) {
changed = true;
}
@@ -1759,6 +1777,9 @@ impl PointerHandler for AppState {
if !is_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
if st.widgets[i].hit_test(st.cursor_x, st.cursor_y, &st.ui_context) {
clicked_idx = Some(i);
break;
@@ -1840,6 +1861,9 @@ impl PointerHandler for AppState {
if !is_visible(i) {
continue;
}
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.mouse_input(btn, cce_ui::widget::ElementState::Released, st.cursor_x, st.cursor_y, &mut st.ui_context) {
changed = true;
}
@@ -2141,7 +2165,10 @@ full screen background.",
let v_scroll = vertical.absolute as f32;
let delta = cce_ui::widget::MouseScrollDelta::LineDelta(-h_scroll / 10.0, -v_scroll / 10.0);
let mut changed = false;
- for w in &mut st.widgets {
+ for (i, w) in st.widgets.iter_mut().enumerate() {
+ if is_control_panel_child(i) {
+ continue;
+ }
if w.mouse_wheel(&delta, st.cursor_x, st.cursor_y, &mut st.ui_context) {
changed = true;
}
@@ -2573,3 +2600,10 @@ fn save_file_dialog_portal(sender: calloop::channel::Sender<String>) {
}
}
+fn is_control_panel_child(index: usize) -> bool {
+ match index {
+ 15..=26 | 38..=44 | 47 => true,
+ _ => false,
+ }
+}
+