InputSignal // +isNumericPadAreaKey().

This commit is contained in:
ShikiSuen 2022-07-24 23:07:10 +08:00
parent f340a6f732
commit ec49e33004
1 changed files with 10 additions and 0 deletions

View File

@ -110,6 +110,11 @@ enum KeyCodeBlackListed: UInt16 {
case kF1 = 122 case kF1 = 122
} }
/// KeyCode
///
/// 95 Key Code JIS
let arrNumpadKeyCodes: [UInt16] = [65, 67, 69, 71, 75, 78, 81, 82, 83, 84, 85, 86, 87, 88, 89, 91, 92, 95]
// CharCodes: https://theasciicode.com.ar/ascii-control-characters/horizontal-tab-ascii-code-9.html // CharCodes: https://theasciicode.com.ar/ascii-control-characters/horizontal-tab-ascii-code-9.html
enum CharCode: UInt16 { enum CharCode: UInt16 {
case yajuusenpaiA = 114 case yajuusenpaiA = 114
@ -256,6 +261,11 @@ struct InputSignal: CustomStringConvertible {
return code.rawValue != KeyCode.kNone.rawValue return code.rawValue != KeyCode.kNone.rawValue
} }
/// flags KeyCode
var isNumericPadAreaKey: Bool {
arrNumpadKeyCodes.contains(keyCode)
}
var isTab: Bool { var isTab: Bool {
KeyCode(rawValue: keyCode) == KeyCode.kTab KeyCode(rawValue: keyCode) == KeyCode.kTab
} }