-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Command palette #656
Command palette #656
Conversation
55d608d
to
d5a376e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing that might be considered blocking is the issue with focus: sometimes the camera still has focus when typing into the command palette and starts moving around.
pub fn step_time_back(&mut self, times_per_timeline: &TimesPerTimeline) { | ||
let Some(time_values) = times_per_timeline.get(self.timeline()) else { return; }; | ||
|
||
self.pause(); | ||
|
||
if let Some(time) = self.time() { | ||
#[allow(clippy::collapsible_else_if)] | ||
let new_time = if let Some(loop_range) = self.active_loop_selection() { | ||
step_back_time_looped(time, time_values, &loop_range) | ||
} else { | ||
step_back_time(time, time_values).into() | ||
}; | ||
self.set_time(new_time); | ||
} | ||
} | ||
|
||
pub fn step_time_fwd(&mut self, times_per_timeline: &TimesPerTimeline) { | ||
let Some(time_values) = times_per_timeline.get(self.timeline()) else { return; }; | ||
|
||
self.pause(); | ||
|
||
if let Some(time) = self.time() { | ||
#[allow(clippy::collapsible_else_if)] | ||
let new_time = if let Some(loop_range) = self.active_loop_selection() { | ||
step_fwd_time_looped(time, time_values, &loop_range) | ||
} else { | ||
step_fwd_time(time, time_values).into() | ||
}; | ||
self.set_time(new_time); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these the exact same functions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They have been moved from a file without change, so in that sense they are still the same.
Their bodies differ though, if that is what you mean (though similar).
|
||
/// Show the command palette, if it is visible. | ||
#[must_use = "Returns the command that was selected"] | ||
pub fn show(&mut self, egui_ctx: &egui::Context) -> Option<Command> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
didn't we decide on calling of these things something_ui
in the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do it for everything that takes a ui: &mut egui::Ui
. This is slightly different high-level thing that creates a Ui
(in this case creates an area where to put stuff). We haven't decided on a consistent naming for that.
You are right about the other functions though.
scroll_to_selected_alternative |= ui.input().key_pressed(Key::ArrowUp); | ||
scroll_to_selected_alternative |= ui.input().key_pressed(Key::ArrowDown); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be (very) nice to support ctrl+k
/ctrl+p
for up and ctrl+j
/ctrl+n
for down; arrow keys are so painful to reach...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you configure your OS to emit arrow-up/down when those keys are pressed?
let commands = self.pending_commands.drain(..).collect_vec(); | ||
for cmd in commands { | ||
self.run_command(cmd, frame, egui_ctx); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need the collection here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup - run_command
takes &mut self
Part of this: emilk/egui#2598 |
I had some time to kill on the plane.
Try it with cmd-P (mac) or ctrl-P (Windows/Linux)
TODO
Checklist
CHANGELOG.md
(if this is a big enough change to warrant it)