Skip to content

Commit

Permalink
fix (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
friendlymatthew authored Jul 2, 2024
1 parent 9143458 commit 4b977cf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions leptos_hotkeys/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
12 changes: 8 additions & 4 deletions leptos_hotkeys/src/hotkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4b977cf

Please sign in to comment.