Skip to content

Commit

Permalink
Implement fn modifier for web
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinegb committed Oct 25, 2024
1 parent 253b623 commit 71a9fa8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/eframe/src/web/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub fn translate_key(key: &str) -> Option<egui::Key> {

pub fn modifiers_from_kb_event(event: &web_sys::KeyboardEvent) -> egui::Modifiers {
egui::Modifiers {
function: event.key() == "Fn",
alt: event.alt_key(),
ctrl: event.ctrl_key(),
shift: event.shift_key(),
Expand All @@ -167,6 +168,7 @@ pub fn modifiers_from_kb_event(event: &web_sys::KeyboardEvent) -> egui::Modifier

pub fn modifiers_from_mouse_event(event: &web_sys::MouseEvent) -> egui::Modifiers {
egui::Modifiers {
function: event.get_modifier_state("Fn"),
alt: event.alt_key(),
ctrl: event.ctrl_key(),
shift: event.shift_key(),
Expand All @@ -183,6 +185,7 @@ pub fn modifiers_from_mouse_event(event: &web_sys::MouseEvent) -> egui::Modifier

pub fn modifiers_from_wheel_event(event: &web_sys::WheelEvent) -> egui::Modifiers {
egui::Modifiers {
function: event.get_modifier_state("Fn"),
alt: event.alt_key(),
ctrl: event.ctrl_key(),
shift: event.shift_key(),
Expand Down

0 comments on commit 71a9fa8

Please sign in to comment.