use super::{Action, Key, KeyCombo, Keybindings, ModifiedKey};
use winit::event::{ModifiersState, VirtualKeyCode};
const IS_MACOS: bool = cfg!(target_os = "macos");
pub fn defaults() -> Keybindings {
let ctrl_or_command = if IS_MACOS {
ModifiersState::LOGO
} else {
ModifiersState::CTRL
};
vec![
(
Action::Copy,
KeyCombo(vec![ModifiedKey(
Key::from(VirtualKeyCode::C),
ctrl_or_command,
)]),
),
(
Action::ZoomIn,
KeyCombo(vec![ModifiedKey(
Key::from(VirtualKeyCode::Equals),
ctrl_or_command | ModifiersState::SHIFT,
)]),
),
(
Action::ZoomIn,
KeyCombo(vec![ModifiedKey(
Key::from(VirtualKeyCode::Plus),
ctrl_or_command | ModifiersState::SHIFT,
)]),
),
(
Action::ZoomOut,
KeyCombo(vec![ModifiedKey(
Key::from(VirtualKeyCode::Minus),
ctrl_or_command,
)]),
),
(
Action::ZoomReset,
KeyCombo(vec![ModifiedKey(
Key::from(VirtualKeyCode::Equals),
ctrl_or_command,
)]),
),
(
Action::ScrollUp,
KeyCombo(vec![ModifiedKey::from(VirtualKeyCode::Up)]),
),
(
Action::ScrollDown,
KeyCombo(vec![ModifiedKey::from(VirtualKeyCode::Down)]),
),
(
Action::ToTop,
KeyCombo(vec![ModifiedKey::from(VirtualKeyCode::Home)]),
),
(
Action::ToBottom,
KeyCombo(vec![ModifiedKey::from(VirtualKeyCode::End)]),
),
]
}