Skip to content

Commit

Permalink
focus current path in path editor widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mrDIMAS committed Dec 20, 2024
1 parent 2a76bdb commit 4fd48b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fyrox-ui/src/file_browser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,12 @@ impl Control for FileBrowser {
if let Ok(canonical_path) = self.path.canonicalize() {
let item = find_tree(self.tree_root, &canonical_path, ui);
if item.is_some() {
// Select item of new path.
ui.send_message(TreeRootMessage::select(
self.tree_root,
MessageDirection::ToWidget,
vec![item],
));
ui.send_message(ScrollViewerMessage::bring_into_view(
self.scroll_viewer,
MessageDirection::ToWidget,
Expand Down
4 changes: 4 additions & 0 deletions fyrox-ui/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ impl Control for PathEditor {
true,
true,
));
ui.send_message(FileSelectorMessage::focus_current_path(
*self.selector,
MessageDirection::ToWidget,
));
}
} else if let Some(PathEditorMessage::Path(path)) = message.data() {
if message.destination() == self.handle
Expand Down

0 comments on commit 4fd48b7

Please sign in to comment.