Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一部のキーを押すと全押し状態になる問題の修正 #924

Merged
merged 1 commit into from
Dec 30, 2020

Conversation

suzme
Copy link
Contributor

@suzme suzme commented Dec 29, 2020

🔨 変更内容 / Details of Changes

  • プレイ中のキー押下処理で_keyCode === ''のとき処理を行わないようにします

🔖 関連Issue, 変更理由 / Related Issues, Reason for Changes

  • 無変換など一部の特殊キーを押したとき全押し状態になってしまいます
  • キーコードが空文字で、無効化された代替キーに反応してしまうようです

📷 スクリーンショット / Screenshot

📝 その他コメント / Other Comments

  • 環境依存かもしれません

@cwtickle
Copy link
Owner

cwtickle commented Dec 30, 2020

PRありがとうございます。
調べてみたところ、音量変更ボタンはkeyboardEvent.keyには値がありますが
keyboardEvent.codeには値がありませんでした。
おそらく、こういった場合に問題が起きていると思われます。

キー操作では現状、keyboardEvent.codeを採用しています。
keyboardEvent.codeを受け取った場合、g_kCdNの値から番号(従来のキーコード相当)を取得し、
g_kCdに対応する値をキーコンフィグ画面へ表示します。
下記の場合、keyboardEvent.codeBackspaceを受け取ると8番が返され、「BS」と表示します。
このとき、上記のように空を受け取った場合は0番を返し、「- - -」と表示していました。

g_kCdN[8] = `Backspace`;
g_kCdN[0] = ``;

g_kCd[8] = `BS`;
g_kCd[0] = `- - -`;

0番はオート/無効値で使用するため、本来割り当ててはいけない番号です。
下記のように、空を割り当てる番号を0から1に変えれば問題は起こらなそうですが、どうでしょうか。
(手元では問題が無いことを確認しています)

  • danoni_constants.js 側の設定
g_kCdN[0] = `XXX`;  // 割り当てできないように任意の文字で置き換え
g_kCdN[1] = ``;        // 未使用番号をcode=空に割り当て

g_kCd[0] = `- - -`;    // 無効用表示
g_kCd[1] = `Volume`;    // 音量などの表示として使用(表示対象ではないが、念のため設定)
  • danoni_main.js 側の設定(5,399行目)
// 先に設定した番号:1を割り当て禁止
const disabledKeys = [1, 229, 240, 242, 243, 244, 91, 29, 28, 27, g_prevKey];

上記を対策することで、メイン画面上でキーブロックする必要はなくなると思います。

@codeclimate
Copy link

codeclimate bot commented Dec 30, 2020

Code Climate has analyzed commit bcf33e7 and detected 0 issues on this pull request.

View more on Code Climate.

@suzme
Copy link
Contributor Author

suzme commented Dec 30, 2020

danoni_constants.jsで設定するように修正しました。
ボリュームとは限らないので、表示するならUnknownとかがいいかなと。

割り当て禁止にはしなくても問題は無さそうですがどうでしょうか。

Copy link
Owner

@cwtickle cwtickle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正ありがとうございます。
結果的に全部直して頂くことになってしまいましたね・・・\(^o^)/

disabledKeyに追加するのは必須で無くても良いと思います。
この内容でマージしますー。

@cwtickle cwtickle merged commit e67a836 into cwtickle:develop Dec 30, 2020
@cwtickle cwtickle added bug Something isn't working func:KeyConfig need-to-fix-supportVer. サポートバージョンへの修正が必要な場合にラベル付け labels Dec 30, 2020
@suzme suzme deleted the disable-undefined-keys branch September 5, 2021 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working func:KeyConfig need-to-fix-supportVer. サポートバージョンへの修正が必要な場合にラベル付け
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants