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

improve: [0660] 1キーにつき常時2キー以上割り当てできるように処理を自動化 #1429

Merged
merged 1 commit into from Mar 12, 2023

Conversation

cwtickle
Copy link
Owner

@cwtickle cwtickle commented Mar 12, 2023

🔨 変更内容 / Details of Changes

  1. 1つのキーにつき常時2キー以上割り当てできるように処理を自動化しました。
    今後、keyCtrlXについて明示的に2キー割当するよう指定しなくても、
    自動で2キー以上割り当てされるようになります。

具体的には、以下の2つの指定は同じ意味になります。

|keyCtrl12i=112,113,114,115,116,117,118,119,120,121,122,123$81,87,69,82,84,89,85,73,79,80,192,219|
|keyCtrl12i=112/0,113/0,114/0,115/0,116/0,117/0,118/0,119/0,120/0,121/0,122/0,123/0$81/0,87/0,69/0,82/0,84/0,89/0,85/0,73/0,79/0,80/0,192/0,219/0|

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

  1. 以前から1つのキーにつき常時2キー以上割り当てできるようになっていましたが、
    明示的な指定が必要になっており、カスタムキーの際に手間となっていました。
    標準実装キーにも適用しているため、今後標準キーを増やす場合でも簡易的な指定ができるようになります。

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

📝 その他コメント / Other Comments

  • makeBaseArray関数を追加しています。
    これを使うと、最小の配列長になるよう配列の長さを調整します。
const array1 = [30];
const array2 = makeBaseArray(array1, 3, 0); // 第1引数: 配列, 第2引数: 最小配列長, 第3引数: 各配列要素のデフォルト値
console.log(array2);  // [30, 0, 0] 

const array3 = [30, 40, 50, 60];
const array4 = makeBaseArray(array1, 3, 0); // 第1引数: 配列, 第2引数: 最小配列長, 第3引数: 各配列要素のデフォルト値
console.log(array4);  // [30, 40, 50, 60]  (最小配列長を超える場合は変化なし)
  • g_keyObj.minKeyCtrlNum を追加しました。
    この変数は1つのキーあたりの最小割り当て数を表しています。デフォルトは2(2キー割り当て)です。

@codeclimate
Copy link

codeclimate bot commented Mar 12, 2023

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

View more on Code Climate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant