mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 12:08:12 +08:00
Fix sending platform-specific shortcut keys to frontend before editor is initialized with the platform set
This commit is contained in:
@@ -136,16 +136,11 @@ pub enum ActionShortcut {
|
||||
|
||||
impl ActionShortcut {
|
||||
pub fn realize_shortcut(&mut self, action_input_mapping: &impl Fn(&MessageDiscriminant) -> Option<KeysGroup>) {
|
||||
match self {
|
||||
Self::Action(action) => {
|
||||
if let Some(keys) = action_input_mapping(action) {
|
||||
*self = Self::Shortcut(keys.into());
|
||||
} else {
|
||||
*self = Self::Shortcut(KeysGroup::default().into());
|
||||
}
|
||||
}
|
||||
Self::Shortcut(shortcut) => {
|
||||
warn!("Calling `.to_keys()` on a `ActionShortcut::Shortcut` is a mistake/bug. Shortcut is: {shortcut:?}.");
|
||||
if let Self::Action(action) = self {
|
||||
if let Some(keys) = action_input_mapping(action) {
|
||||
*self = Self::Shortcut(keys.into());
|
||||
} else {
|
||||
*self = Self::Shortcut(KeysGroup::default().into());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user