Improved ghost with paginator

This commit is contained in:
2025-08-09 02:44:17 +02:00
parent 3520369e35
commit 20a9d2b216
3 changed files with 7 additions and 7 deletions
+4
View File
@@ -75,6 +75,10 @@ impl Element for Paginator {
}
}
fn is_ghost(&mut self) -> bool {
true
}
fn draw_child(&mut self, element: &Arc<Widget>) {
self.children.push(element.clone());
element.inject(|w| w.component(NoRenderRoot));
+1 -1
View File
@@ -118,7 +118,7 @@ impl Extension for RelativeFocusExtension {
for (i, w) in ctx.get_widgets().iter().enumerate() {
if let Some(AlwaysFocused) = w.get() {
w.set_focused(true);
} else {
} else if !w.is_ghost() {
w.set_focused(i == self.cursor);
}
}
+2 -6
View File
@@ -161,12 +161,8 @@ impl Widget {
pub fn set_focused(&self, f: bool) {
match self {
Self::Dynamic(w) => {
*w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost()
}
Self::Static(w) => {
*w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost()
}
Self::Dynamic(w) => *w.focused.lock().unwrap() = f,
Self::Static(w) => *w.focused.lock().unwrap() = f,
}
}