Fixed ALT scope from normal scope.
This commit is contained in:
parent
76fe91b7a1
commit
b20de94c06
|
@ -63,46 +63,49 @@ fn commands() -> impl UiNode {
|
|||
let scope = WidgetId::named("scroll");
|
||||
use menu::CmdButton;
|
||||
|
||||
Menu!(ui_vec![
|
||||
SubMenu!(
|
||||
"Scroll",
|
||||
ui_vec![
|
||||
CmdButton!(SCROLL_UP_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_DOWN_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_LEFT_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_RIGHT_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Page",
|
||||
ui_vec![
|
||||
CmdButton!(PAGE_UP_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_DOWN_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_LEFT_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_RIGHT_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Scroll to",
|
||||
ui_vec![
|
||||
CmdButton!(SCROLL_TO_TOP_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_BOTTOM_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_LEFTMOST_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_RIGHTMOST_CMD.scoped(scope)),
|
||||
Hr!(),
|
||||
scroll_to_btn(WidgetId::named("Lorem 2"), ScrollToMode::minimal(10)),
|
||||
scroll_to_btn(WidgetId::named("Lorem 2"), ScrollToMode::center()),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Zoom",
|
||||
ui_vec![
|
||||
CmdButton!(ZOOM_IN_CMD.scoped(scope)),
|
||||
CmdButton!(ZOOM_OUT_CMD.scoped(scope)),
|
||||
CmdButton!(ZOOM_RESET_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
])
|
||||
Menu! {
|
||||
id = "menu";
|
||||
children = ui_vec![
|
||||
SubMenu!(
|
||||
"Scroll",
|
||||
ui_vec![
|
||||
CmdButton!(SCROLL_UP_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_DOWN_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_LEFT_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_RIGHT_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Page",
|
||||
ui_vec![
|
||||
CmdButton!(PAGE_UP_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_DOWN_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_LEFT_CMD.scoped(scope)),
|
||||
CmdButton!(PAGE_RIGHT_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Scroll to",
|
||||
ui_vec![
|
||||
CmdButton!(SCROLL_TO_TOP_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_BOTTOM_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_LEFTMOST_CMD.scoped(scope)),
|
||||
CmdButton!(SCROLL_TO_RIGHTMOST_CMD.scoped(scope)),
|
||||
Hr!(),
|
||||
scroll_to_btn(WidgetId::named("Lorem 2"), ScrollToMode::minimal(10)),
|
||||
scroll_to_btn(WidgetId::named("Lorem 2"), ScrollToMode::center()),
|
||||
]
|
||||
),
|
||||
SubMenu!(
|
||||
"Zoom",
|
||||
ui_vec![
|
||||
CmdButton!(ZOOM_IN_CMD.scoped(scope)),
|
||||
CmdButton!(ZOOM_OUT_CMD.scoped(scope)),
|
||||
CmdButton!(ZOOM_RESET_CMD.scoped(scope)),
|
||||
]
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
fn scroll_to_btn(target: WidgetId, mode: ScrollToMode) -> impl UiNode {
|
||||
use zero_ui::widgets::scroll::commands;
|
||||
|
|
|
@ -730,8 +730,17 @@ impl WidgetFocusInfo {
|
|||
None
|
||||
} else if self.is_scope() {
|
||||
// if we are a normal scope, try for an inner ALT scope descendant first.
|
||||
self.inner_alt_scope()
|
||||
let r = self.inner_alt_scope();
|
||||
if r.is_some() {
|
||||
return r;
|
||||
}
|
||||
if let Some(scope) = self.scope() {
|
||||
// search sibling ALT scope.
|
||||
return scope.inner_alt_scope_skip(self);
|
||||
}
|
||||
None
|
||||
} else if let Some(scope) = self.scope() {
|
||||
// search sibling ALT scope.
|
||||
scope.inner_alt_scope_skip(self)
|
||||
} else {
|
||||
// we reached root, no ALT found.
|
||||
|
|
Loading…
Reference in New Issue