Revamp key/code input processing which fixes Option key on Mac and other locales

Closes #742
Closes #746
This commit is contained in:
Keavon Chambers
2022-08-11 02:53:46 -07:00
parent 765b648704
commit cf6bbcfd30
32 changed files with 1143 additions and 548 deletions
@@ -1358,6 +1358,7 @@ impl DocumentMessageHandler {
size: 24,
icon: "ZoomIn".into(),
tooltip: "Zoom In".into(),
tooltip_shortcut: action_keys!(MovementMessageDiscriminant::IncreaseCanvasZoom),
on_update: WidgetCallback::new(|_| MovementMessage::IncreaseCanvasZoom { center_on_mouse: false }.into()),
..IconButton::default()
})),
@@ -1365,6 +1366,7 @@ impl DocumentMessageHandler {
size: 24,
icon: "ZoomOut".into(),
tooltip: "Zoom Out".into(),
tooltip_shortcut: action_keys!(MovementMessageDiscriminant::DecreaseCanvasZoom),
on_update: WidgetCallback::new(|_| MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }.into()),
..IconButton::default()
})),
@@ -1372,6 +1374,7 @@ impl DocumentMessageHandler {
size: 24,
icon: "ZoomReset".into(),
tooltip: "Zoom to 100%".into(),
tooltip_shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent),
on_update: WidgetCallback::new(|_| MovementMessage::SetCanvasZoom { zoom_factor: 1. }.into()),
..IconButton::default()
})),
@@ -164,7 +164,7 @@ impl MessageHandler<MovementMessage, (&Document, &InputPreprocessorMessageHandle
responses.push_back(
FrontendMessage::UpdateInputHints {
hint_data: HintData(vec![HintGroup(vec![HintInfo {
key_groups: vec![KeysGroup(vec![Key::KeyControl])],
key_groups: vec![KeysGroup(vec![Key::Control])],
key_groups_mac: None,
mouse: None,
label: String::from("Snap 15°"),
@@ -246,7 +246,7 @@ impl MessageHandler<MovementMessage, (&Document, &InputPreprocessorMessageHandle
responses.push_back(
FrontendMessage::UpdateInputHints {
hint_data: HintData(vec![HintGroup(vec![HintInfo {
key_groups: vec![KeysGroup(vec![Key::KeyControl])],
key_groups: vec![KeysGroup(vec![Key::Control])],
key_groups_mac: None,
mouse: None,
label: String::from("Snap Increments"),