mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-17 07:18:04 +08:00
Implement input hints based on the active tool state (#388)
* Hook up user input hints to display in the frontend status bar Closes #171 * MVP hint system based on tool FSM * Fix hints for Fill and Eyedropper tools * Add icons for keyboard shortcuts * Fix hints for Pen Tool * Cleanup
This commit is contained in:
@@ -18,6 +18,7 @@ const SHIFT_NUDGE_AMOUNT: f64 = 10.;
|
||||
pub enum InputMapperMessage {
|
||||
PointerMove,
|
||||
MouseScroll,
|
||||
#[child]
|
||||
KeyUp(Key),
|
||||
#[child]
|
||||
KeyDown(Key),
|
||||
@@ -43,6 +44,7 @@ impl KeyMappingEntries {
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn push(&mut self, entry: MappingEntry) {
|
||||
self.0.push(entry)
|
||||
}
|
||||
@@ -187,7 +189,8 @@ impl Default for Mapping {
|
||||
entry! {action=PenMessage::Confirm, key_down=KeyEscape},
|
||||
entry! {action=PenMessage::Confirm, key_down=KeyEnter},
|
||||
// Fill
|
||||
entry! {action=FillMessage::MouseDown, key_down=Lmb},
|
||||
entry! {action=FillMessage::LeftMouseDown, key_down=Lmb},
|
||||
entry! {action=FillMessage::RightMouseDown, key_down=Rmb},
|
||||
// Tool Actions
|
||||
entry! {action=ToolMessage::ActivateTool(ToolType::Select), key_down=KeyV},
|
||||
entry! {action=ToolMessage::ActivateTool(ToolType::Eyedropper), key_down=KeyI},
|
||||
|
||||
@@ -16,6 +16,7 @@ pub type KeyStates = BitVector<KEY_MASK_STORAGE_LENGTH>;
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Key {
|
||||
UnknownKey,
|
||||
|
||||
// MouseKeys
|
||||
Lmb,
|
||||
Rmb,
|
||||
@@ -87,6 +88,20 @@ pub enum Key {
|
||||
NumKeys,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum MouseMotion {
|
||||
None,
|
||||
Lmb,
|
||||
Rmb,
|
||||
Mmb,
|
||||
ScrollUp,
|
||||
ScrollDown,
|
||||
Drag,
|
||||
LmbDrag,
|
||||
RmbDrag,
|
||||
MmbDrag,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct BitVector<const LENGTH: usize>([StorageType; LENGTH]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user