mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 04:18:11 +08:00
Implement key handling (#65)
This commit is contained in:
committed by
Keavon Chambers
parent
599d478a5c
commit
0a112be97b
@@ -1,4 +1,5 @@
|
||||
use crate::shims::Error;
|
||||
use editor_core::events;
|
||||
use editor_core::tools::{SelectAppendMode, ToolType};
|
||||
use editor_core::Color as InnerColor;
|
||||
use wasm_bindgen::prelude::*;
|
||||
@@ -48,3 +49,24 @@ pub fn translate_append_mode(name: &str) -> Option<SelectAppendMode> {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn translate_key(name: &str) -> events::Key {
|
||||
use events::Key as K;
|
||||
match name {
|
||||
"e" => K::KeyE,
|
||||
"r" => K::KeyR,
|
||||
"m" => K::KeyM,
|
||||
"x" => K::KeyX,
|
||||
"0" => K::Key0,
|
||||
"1" => K::Key1,
|
||||
"2" => K::Key2,
|
||||
"3" => K::Key3,
|
||||
"4" => K::Key4,
|
||||
"5" => K::Key5,
|
||||
"6" => K::Key6,
|
||||
"7" => K::Key7,
|
||||
"8" => K::Key8,
|
||||
"9" => K::Key9,
|
||||
_ => K::UnknownKey,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user