cloud storage client
git clone https://git.lucas.co/cce-cloud.git
fix(json): resize the popup when a target_page button switches pages
The JSON popup is sized to its active page, but a page switch happened
inside propagate_event and never reached update_desired_size, so a submenu
page with more rows than the first (the window context menu's "Window Mode"
page) was clipped to the first page's height. Compare the active page
across the event and resize when it moved.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
src/main.rs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/main.rs b/src/main.rs
index 407accf..4141a82 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2485,7 +2485,16 @@ impl PointerHandler for AppState {
if st.mode == LauncherMode::Json {
let mut changed = false;
let mut clicked_btn_id = None;
+ // A `target_page` button switches pages inside
+ // propagate_event (JsonLayoutWidget takes its
+ // click there, so it never reaches the
+ // clicked_btn_id scan below). The popup is
+ // sized per page — a submenu page with more
+ // rows than the first was clipped to the first
+ // page's height until this resize.
+ let mut page_switched = false;
if let Some(jl) = &mut st.json_layout {
+ let page_before = jl.active_page;
let ev = cce_ui::widget::Event::MouseButton {
button: cce_ui::widget::MouseButton::Left,
state: cce_ui::widget::ElementState::Released,
@@ -2499,6 +2508,7 @@ impl PointerHandler for AppState {
if st.ui_context.propagate_event(&ev, root) {
changed = true;
}
+ page_switched = jl.active_page != page_before;
for w in &mut jl.widgets {
// take_click is an WidgetHost method; Phase 5 Buttons are
// Adapted, so ask the box directly.
@@ -2508,6 +2518,10 @@ impl PointerHandler for AppState {
}
}
}
+ if page_switched {
+ st.update_desired_size();
+ changed = true;
+ }
if changed {
st.upload_vertices();
self.redraw = true;