Improved ghost with paginator
This commit is contained in:
@@ -75,6 +75,10 @@ impl Element for Paginator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn is_ghost(&mut self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
fn draw_child(&mut self, element: &Arc<Widget>) {
|
fn draw_child(&mut self, element: &Arc<Widget>) {
|
||||||
self.children.push(element.clone());
|
self.children.push(element.clone());
|
||||||
element.inject(|w| w.component(NoRenderRoot));
|
element.inject(|w| w.component(NoRenderRoot));
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ impl Extension for RelativeFocusExtension {
|
|||||||
for (i, w) in ctx.get_widgets().iter().enumerate() {
|
for (i, w) in ctx.get_widgets().iter().enumerate() {
|
||||||
if let Some(AlwaysFocused) = w.get() {
|
if let Some(AlwaysFocused) = w.get() {
|
||||||
w.set_focused(true);
|
w.set_focused(true);
|
||||||
} else {
|
} else if !w.is_ghost() {
|
||||||
w.set_focused(i == self.cursor);
|
w.set_focused(i == self.cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -161,12 +161,8 @@ impl Widget {
|
|||||||
|
|
||||||
pub fn set_focused(&self, f: bool) {
|
pub fn set_focused(&self, f: bool) {
|
||||||
match self {
|
match self {
|
||||||
Self::Dynamic(w) => {
|
Self::Dynamic(w) => *w.focused.lock().unwrap() = f,
|
||||||
*w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost()
|
Self::Static(w) => *w.focused.lock().unwrap() = f,
|
||||||
}
|
|
||||||
Self::Static(w) => {
|
|
||||||
*w.focused.lock().unwrap() = f && !w.element.lock().unwrap().is_ghost()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user