From 4b977cf92b5b3801d7610c723f83239ef6daf804 Mon Sep 17 00:00:00 2001 From: Matthew Kim <38759997+friendlymatthew@users.noreply.github.com> Date: Tue, 2 Jul 2024 10:33:17 -0400 Subject: [PATCH] fix (#117) --- CHANGELOG.md | 5 ++++- Cargo.lock | 2 +- leptos_hotkeys/Cargo.toml | 4 ++-- leptos_hotkeys/src/hotkey.rs | 12 ++++++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ed6e67..499fbdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,11 @@ # Changelog +## _July 2nd, 2024_ - [0.2.2] +- Fix bugs related to keycode management + ## _May 27th, 2024_ - [0.2.1] +- Code movement, change to using keycodes -### Bug fixes - Fix right/left modifiers not being recognized. diff --git a/Cargo.lock b/Cargo.lock index f19047a..8ead66f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1061,7 +1061,7 @@ dependencies = [ [[package]] name = "leptos_hotkeys" -version = "0.2.0" +version = "0.2.2" dependencies = [ "leptos", "log", diff --git a/leptos_hotkeys/Cargo.toml b/leptos_hotkeys/Cargo.toml index 8df6707..89a38c3 100644 --- a/leptos_hotkeys/Cargo.toml +++ b/leptos_hotkeys/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "leptos_hotkeys" -version = "0.2.1" +version = "0.2.2" edition = "2021" description = "A library that declaratively pairs keybindings with callbacks for Leptos applications." license = "MIT" repository = "https://github.com/gaucho-labs/leptos-hotkeys" readme = "../README.md" -authors = ["Matthew Kim", "Álvaro Mondéjar Rubio", "Robert Junkins"] +authors = ["Matthew Kim", "Álvaro Mondéjar Rubio", "Robert Junkins", "Zak Stucke"] keywords = ["leptos", "hotkeys", "wasm"] [dependencies] diff --git a/leptos_hotkeys/src/hotkey.rs b/leptos_hotkeys/src/hotkey.rs index da99db0..6181ea1 100644 --- a/leptos_hotkeys/src/hotkey.rs +++ b/leptos_hotkeys/src/hotkey.rs @@ -83,19 +83,23 @@ pub(crate) fn is_hotkey_match( let mut modifiers_match = true; if hotkey.modifiers.ctrl { - modifiers_match &= pressed_keyset.contains_key("control"); + modifiers_match &= pressed_keyset.contains_key("controlleft") + || pressed_keyset.contains_key("controlright"); } if hotkey.modifiers.shift { - modifiers_match &= pressed_keyset.contains_key("shift"); + modifiers_match &= + pressed_keyset.contains_key("shiftleft") || pressed_keyset.contains_key("shiftright"); } if hotkey.modifiers.meta { - modifiers_match &= pressed_keyset.contains_key("meta"); + modifiers_match &= + pressed_keyset.contains_key("metaleft") || pressed_keyset.contains_key("metaright"); } if hotkey.modifiers.alt { - modifiers_match &= pressed_keyset.contains_key("alt"); + modifiers_match &= + pressed_keyset.contains_key("altleft") || pressed_keyset.contains_key("altright"); } if modifiers_match {