summaryrefslogtreecommitdiffstats
path: root/examples/layout
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-16 13:28:00 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-01-16 13:28:00 +0100
commit64d1ce5532f55d152fa5819532a138da2dca1a39 (patch)
tree1a242bde122b5e715f2e980c5541353e2ae8b048 /examples/layout
parent534c7dd7b0bc515c31b6de87b4aa6a35b44c46a0 (diff)
downloadiced-64d1ce5532f55d152fa5819532a138da2dca1a39.tar.gz
iced-64d1ce5532f55d152fa5819532a138da2dca1a39.tar.bz2
iced-64d1ce5532f55d152fa5819532a138da2dca1a39.zip
Refactor `KeyCode` into `Key` and `Location`
Diffstat (limited to 'examples/layout')
-rw-r--r--examples/layout/src/main.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/layout/src/main.rs b/examples/layout/src/main.rs
index 60dabe54..6cf0e570 100644
--- a/examples/layout/src/main.rs
+++ b/examples/layout/src/main.rs
@@ -71,9 +71,13 @@ impl Application for Layout {
}
fn subscription(&self) -> Subscription<Message> {
- keyboard::on_key_release(|key_code, _modifiers| match key_code {
- keyboard::KeyCode::Left => Some(Message::Previous),
- keyboard::KeyCode::Right => Some(Message::Next),
+ use keyboard::key;
+
+ keyboard::on_key_release(|key, _modifiers| match key {
+ keyboard::Key::Named(key::Named::ArrowLeft) => {
+ Some(Message::Previous)
+ }
+ keyboard::Key::Named(key::Named::ArrowRight) => Some(Message::Next),
_ => None,
})
}