Improve navigation footer bar hints
This commit is contained in:
parent
f8b9c5db6d
commit
8f9371dad0
|
|
@ -196,9 +196,10 @@ impl MessageHandler<NavigationMessage, (&Document, Option<[DVec2; 2]>, &InputPre
|
||||||
mouse: None,
|
mouse: None,
|
||||||
label: String::from("Snap 15°"),
|
label: String::from("Snap 15°"),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}]),
|
}]),
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Confirm")]),
|
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Confirm")]),
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Abort")]),
|
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Cancel")]),
|
||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -269,7 +270,7 @@ impl MessageHandler<NavigationMessage, (&Document, Option<[DVec2; 2]>, &InputPre
|
||||||
responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Grabbing });
|
responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Grabbing });
|
||||||
|
|
||||||
responses.add(FrontendMessage::UpdateInputHints {
|
responses.add(FrontendMessage::UpdateInputHints {
|
||||||
hint_data: HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Abort")])]),
|
hint_data: HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Cancel")])]),
|
||||||
});
|
});
|
||||||
|
|
||||||
self.mouse_position = ipp.mouse.position;
|
self.mouse_position = ipp.mouse.position;
|
||||||
|
|
@ -308,10 +309,11 @@ impl MessageHandler<NavigationMessage, (&Document, Option<[DVec2; 2]>, &InputPre
|
||||||
key_groups: vec![KeysGroup(vec![Key::Control]).into()],
|
key_groups: vec![KeysGroup(vec![Key::Control]).into()],
|
||||||
key_groups_mac: None,
|
key_groups_mac: None,
|
||||||
mouse: None,
|
mouse: None,
|
||||||
label: String::from("Snap Increments"),
|
label: String::from("Increments"),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}]),
|
}]),
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Abort")]),
|
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, "Cancel")]),
|
||||||
]),
|
]),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -162,16 +162,15 @@ impl Fsm for NavigateToolFsmState {
|
||||||
let hint_data = match self {
|
let hint_data = match self {
|
||||||
NavigateToolFsmState::Ready => HintData(vec![
|
NavigateToolFsmState::Ready => HintData(vec![
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Zoom In"), HintInfo::keys([Key::Shift], "Zoom Out").prepend_plus()]),
|
HintGroup(vec![HintInfo::mouse(MouseMotion::Lmb, "Zoom In"), HintInfo::keys([Key::Shift], "Zoom Out").prepend_plus()]),
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::LmbDrag, "Zoom"), HintInfo::keys([Key::Control], "Snap Increments").prepend_plus()]),
|
HintGroup(vec![HintInfo::mouse(MouseMotion::LmbDrag, "Zoom"), HintInfo::keys([Key::Control], "Increments").prepend_plus()]),
|
||||||
HintGroup(vec![
|
HintGroup(vec![
|
||||||
HintInfo::mouse(MouseMotion::LmbDrag, " "),
|
HintInfo::keys_and_mouse([Key::Space], MouseMotion::LmbDrag, ""),
|
||||||
HintInfo::keys([Key::Space], "Or").prepend_plus(),
|
HintInfo::mouse(MouseMotion::MmbDrag, "Pan").prepend_slash(),
|
||||||
HintInfo::mouse(MouseMotion::MmbDrag, "Pan"),
|
|
||||||
]),
|
]),
|
||||||
HintGroup(vec![HintInfo::mouse(MouseMotion::LmbDrag, ""), HintInfo::keys([Key::Alt], "Tilt").prepend_plus()]),
|
HintGroup(vec![HintInfo::keys_and_mouse([Key::Alt], MouseMotion::LmbDrag, "Tilt")]),
|
||||||
]),
|
]),
|
||||||
NavigateToolFsmState::Tilting => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Control], "Snap 15°")])]),
|
NavigateToolFsmState::Tilting => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Control], "Snap 15°")])]),
|
||||||
NavigateToolFsmState::Zooming => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Control], "Snap Increments")])]),
|
NavigateToolFsmState::Zooming => HintData(vec![HintGroup(vec![HintInfo::keys([Key::Control], "Increments")])]),
|
||||||
_ => HintData(Vec::new()),
|
_ => HintData(Vec::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -495,6 +495,8 @@ pub struct HintInfo {
|
||||||
pub label: String,
|
pub label: String,
|
||||||
/// Draws a prepended "+" symbol which indicates that this is a refinement upon a previous hint in the group.
|
/// Draws a prepended "+" symbol which indicates that this is a refinement upon a previous hint in the group.
|
||||||
pub plus: bool,
|
pub plus: bool,
|
||||||
|
/// Draws a prepended "/" symbol which indicates that this is an alternative to a previous hint in the group.
|
||||||
|
pub slash: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl HintInfo {
|
impl HintInfo {
|
||||||
|
|
@ -506,6 +508,19 @@ impl HintInfo {
|
||||||
mouse: None,
|
mouse: None,
|
||||||
label: label.into(),
|
label: label.into(),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn multi_keys(multi_keys: impl IntoIterator<Item = impl IntoIterator<Item = Key>>, label: impl Into<String>) -> Self {
|
||||||
|
let key_groups = multi_keys.into_iter().map(|keys| KeysGroup(keys.into_iter().collect()).into()).collect();
|
||||||
|
Self {
|
||||||
|
key_groups,
|
||||||
|
key_groups_mac: None,
|
||||||
|
mouse: None,
|
||||||
|
label: label.into(),
|
||||||
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -516,6 +531,7 @@ impl HintInfo {
|
||||||
mouse: Some(mouse_motion),
|
mouse: Some(mouse_motion),
|
||||||
label: label.into(),
|
label: label.into(),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -526,6 +542,7 @@ impl HintInfo {
|
||||||
mouse: None,
|
mouse: None,
|
||||||
label: label.into(),
|
label: label.into(),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -537,22 +554,25 @@ impl HintInfo {
|
||||||
mouse: Some(mouse_motion),
|
mouse: Some(mouse_motion),
|
||||||
label: label.into(),
|
label: label.into(),
|
||||||
plus: false,
|
plus: false,
|
||||||
|
slash: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn multi_keys_and_mouse(multi_keys: impl IntoIterator<Item = impl IntoIterator<Item = Key>>, mouse_motion: MouseMotion, label: impl Into<String>) -> Self {
|
||||||
|
let key_groups = multi_keys.into_iter().map(|keys| KeysGroup(keys.into_iter().collect()).into()).collect();
|
||||||
|
Self {
|
||||||
|
key_groups,
|
||||||
|
key_groups_mac: None,
|
||||||
|
mouse: Some(mouse_motion),
|
||||||
|
label: label.into(),
|
||||||
|
plus: false,
|
||||||
|
slash: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn arrow_keys(label: impl Into<String>) -> Self {
|
pub fn arrow_keys(label: impl Into<String>) -> Self {
|
||||||
HintInfo {
|
let multi_keys = [[Key::ArrowUp], [Key::ArrowRight], [Key::ArrowDown], [Key::ArrowLeft]];
|
||||||
key_groups: vec![
|
Self::multi_keys(multi_keys, label)
|
||||||
KeysGroup(vec![Key::ArrowUp]).into(),
|
|
||||||
KeysGroup(vec![Key::ArrowRight]).into(),
|
|
||||||
KeysGroup(vec![Key::ArrowDown]).into(),
|
|
||||||
KeysGroup(vec![Key::ArrowLeft]).into(),
|
|
||||||
],
|
|
||||||
key_groups_mac: None,
|
|
||||||
mouse: None,
|
|
||||||
label: label.into(),
|
|
||||||
plus: false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prepend_plus(mut self) -> Self {
|
pub fn prepend_plus(mut self) -> Self {
|
||||||
|
|
@ -560,6 +580,11 @@ impl HintInfo {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn prepend_slash(mut self) -> Self {
|
||||||
|
self.slash = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn add_mac_keys(mut self, keys: impl IntoIterator<Item = Key>) -> Self {
|
pub fn add_mac_keys(mut self, keys: impl IntoIterator<Item = Key>) -> Self {
|
||||||
let mac_keys: Vec<_> = keys.into_iter().collect();
|
let mac_keys: Vec<_> = keys.into_iter().collect();
|
||||||
self.key_groups_mac = Some(vec![KeysGroup(mac_keys).into()]);
|
self.key_groups_mac = Some(vec![KeysGroup(mac_keys).into()]);
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hint-text {
|
.hint-text:not(:empty) {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,9 @@
|
||||||
{#if hint.plus}
|
{#if hint.plus}
|
||||||
<LayoutRow class="plus">+</LayoutRow>
|
<LayoutRow class="plus">+</LayoutRow>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if hint.slash}
|
||||||
|
<LayoutRow class="slash">/</LayoutRow>
|
||||||
|
{/if}
|
||||||
<UserInputLabel mouseMotion={hint.mouse} keysWithLabelsGroups={inputKeysForPlatform(hint)}>{hint.label}</UserInputLabel>
|
<UserInputLabel mouseMotion={hint.mouse} keysWithLabelsGroups={inputKeysForPlatform(hint)}>{hint.label}</UserInputLabel>
|
||||||
{/each}
|
{/each}
|
||||||
{/each}
|
{/each}
|
||||||
|
|
@ -57,7 +60,8 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plus {
|
.plus,
|
||||||
|
.slash {
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,8 @@ export class HintInfo {
|
||||||
readonly label!: string;
|
readonly label!: string;
|
||||||
|
|
||||||
readonly plus!: boolean;
|
readonly plus!: boolean;
|
||||||
|
|
||||||
|
readonly slash!: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rust enum `Key`
|
// Rust enum `Key`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue