keyCode.js 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. "use strict";
  2. /*
  3. Copyright (c) 2022-2023 Xiamen Yaji Software Co., Ltd.
  4. https://www.cocos.com/
  5. Permission is hereby granted, free of charge, to any person obtaining a copy
  6. of this software and associated documentation files (the "Software"), to deal
  7. in the Software without restriction, including without limitation the rights to
  8. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  9. of the Software, and to permit persons to whom the Software is furnished to do so,
  10. subject to the following conditions:None
  11. The above copyright notice and this permission notice shall be included in
  12. all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. THE SOFTWARE.
  20. */
  21. Object.defineProperty(exports, "__esModule", { value: true });
  22. exports.KeyCode = void 0;
  23. /**
  24. * @en Enum type of keyCode for key event
  25. * @zh 按键事件的按键码
  26. */
  27. exports.KeyCode = {
  28. /**
  29. * @en None
  30. * @zh 没有分配
  31. */
  32. NONE: 0,
  33. /**
  34. * @en The back key on mobile phone
  35. * @zh 移动端返回键
  36. */
  37. MOBILE_BACK: 6,
  38. /**
  39. * @en The backspace key
  40. * @zh 退格键
  41. */
  42. BACKSPACE: 8,
  43. /**
  44. * @en The tab key
  45. * @zh Tab 键
  46. */
  47. TAB: 9,
  48. /**
  49. * @en The enter key
  50. * @zh 回车键
  51. */
  52. ENTER: 13,
  53. /**
  54. * @en The left shift key
  55. * @zh 左 Shift 键
  56. */
  57. SHIFT_LEFT: 16,
  58. /**
  59. * @en The left ctrl key
  60. * @zh 左 Ctrl 键
  61. */
  62. CTRL_LEFT: 17,
  63. /**
  64. * @en The left alt key
  65. * @zh 左 Alt 键
  66. */
  67. ALT_LEFT: 18,
  68. /**
  69. * @en The pause key
  70. * @zh 暂停键
  71. */
  72. PAUSE: 19,
  73. /**
  74. * @en The caps lock key
  75. * @zh 大写锁定键
  76. */
  77. CAPS_LOCK: 20,
  78. /**
  79. * @en The esc key
  80. * @zh ESC 键
  81. */
  82. ESCAPE: 27,
  83. /**
  84. * @en The space key
  85. * @zh 空格键
  86. */
  87. SPACE: 32,
  88. /**
  89. * @en The page up key
  90. * @zh 向上翻页键
  91. */
  92. PAGE_UP: 33,
  93. /**
  94. * @en The page down key
  95. * @zh 向下翻页键
  96. */
  97. PAGE_DOWN: 34,
  98. /**
  99. * @en The end key
  100. * @zh 结束键
  101. */
  102. END: 35,
  103. /**
  104. * @en The home key
  105. * @zh 主菜单键
  106. */
  107. HOME: 36,
  108. /**
  109. * @en The left key
  110. * @zh 向左箭头键
  111. */
  112. ARROW_LEFT: 37,
  113. /**
  114. * @en The up key
  115. * @zh 向上箭头键
  116. */
  117. ARROW_UP: 38,
  118. /**
  119. * @en The right key
  120. * @zh 向右箭头键
  121. */
  122. ARROW_RIGHT: 39,
  123. /**
  124. * @en The down key
  125. * @zh 向下箭头键
  126. */
  127. ARROW_DOWN: 40,
  128. /**
  129. * @en The insert key
  130. * @zh 插入键
  131. */
  132. INSERT: 45,
  133. /**
  134. * @en The Delete key
  135. * @zh 删除键
  136. */
  137. DELETE: 46,
  138. /**
  139. * @en The '0' key on the top of the alphanumeric keyboard.
  140. * @zh 字母键盘上的 0 键
  141. */
  142. DIGIT_0: 48,
  143. /**
  144. * @en The '1' key on the top of the alphanumeric keyboard.
  145. * @zh 字母键盘上的 1 键
  146. */
  147. DIGIT_1: 49,
  148. /**
  149. * @en The '2' key on the top of the alphanumeric keyboard.
  150. * @zh 字母键盘上的 2 键
  151. */
  152. DIGIT_2: 50,
  153. /**
  154. * @en The '3' key on the top of the alphanumeric keyboard.
  155. * @zh 字母键盘上的 3 键
  156. */
  157. DIGIT_3: 51,
  158. /**
  159. * @en The '4' key on the top of the alphanumeric keyboard.
  160. * @zh 字母键盘上的 4 键
  161. */
  162. DIGIT_4: 52,
  163. /**
  164. * @en The '5' key on the top of the alphanumeric keyboard.
  165. * @zh 字母键盘上的 5 键
  166. */
  167. DIGIT_5: 53,
  168. /**
  169. * @en The '6' key on the top of the alphanumeric keyboard.
  170. * @zh 字母键盘上的 6 键
  171. */
  172. DIGIT_6: 54,
  173. /**
  174. * @en The '7' key on the top of the alphanumeric keyboard.
  175. * @zh 字母键盘上的 7 键
  176. */
  177. DIGIT_7: 55,
  178. /**
  179. * @en The '8' key on the top of the alphanumeric keyboard.
  180. * @zh 字母键盘上的 8 键
  181. */
  182. DIGIT_8: 56,
  183. /**
  184. * @en The '9' key on the top of the alphanumeric keyboard.
  185. * @zh 字母键盘上的 9 键
  186. */
  187. DIGIT_9: 57,
  188. /**
  189. * @en The a key
  190. * @zh A 键
  191. */
  192. KEY_A: 65,
  193. /**
  194. * @en The b key
  195. * @zh B 键
  196. */
  197. KEY_B: 66,
  198. /**
  199. * @en The c key
  200. * @zh C 键
  201. */
  202. KEY_C: 67,
  203. /**
  204. * @en The d key
  205. * @zh D 键
  206. */
  207. KEY_D: 68,
  208. /**
  209. * @en The e key
  210. * @zh E 键
  211. */
  212. KEY_E: 69,
  213. /**
  214. * @en The f key
  215. * @zh F 键
  216. */
  217. KEY_F: 70,
  218. /**
  219. * @en The g key
  220. * @zh G 键
  221. */
  222. KEY_G: 71,
  223. /**
  224. * @en The h key
  225. * @zh H 键
  226. */
  227. KEY_H: 72,
  228. /**
  229. * @en The i key
  230. * @zh I 键
  231. */
  232. KEY_I: 73,
  233. /**
  234. * @en The j key
  235. * @zh J 键
  236. */
  237. KEY_J: 74,
  238. /**
  239. * @en The k key
  240. * @zh K 键
  241. */
  242. KEY_K: 75,
  243. /**
  244. * @en The l key
  245. * @zh L 键
  246. */
  247. KEY_L: 76,
  248. /**
  249. * @en The m key
  250. * @zh M 键
  251. */
  252. KEY_M: 77,
  253. /**
  254. * @en The n key
  255. * @zh N 键
  256. */
  257. KEY_N: 78,
  258. /**
  259. * @en The o key
  260. * @zh O 键
  261. */
  262. KEY_O: 79,
  263. /**
  264. * @en The p key
  265. * @zh P 键
  266. */
  267. KEY_P: 80,
  268. /**
  269. * @en The q key
  270. * @zh Q 键
  271. */
  272. KEY_Q: 81,
  273. /**
  274. * @en The r key
  275. * @zh R 键
  276. */
  277. KEY_R: 82,
  278. /**
  279. * @en The s key
  280. * @zh S 键
  281. */
  282. KEY_S: 83,
  283. /**
  284. * @en The t key
  285. * @zh T 键
  286. */
  287. KEY_T: 84,
  288. /**
  289. * @en The u key
  290. * @zh U 键
  291. */
  292. KEY_U: 85,
  293. /**
  294. * @en The v key
  295. * @zh V 键
  296. */
  297. KEY_V: 86,
  298. /**
  299. * @en The w key
  300. * @zh W 键
  301. */
  302. KEY_W: 87,
  303. /**
  304. * @en The x key
  305. * @zh X 键
  306. */
  307. KEY_X: 88,
  308. /**
  309. * @en The y key
  310. * @zh Y 键
  311. */
  312. KEY_Y: 89,
  313. /**
  314. * @en The z key
  315. * @zh Z 键
  316. */
  317. KEY_Z: 90,
  318. /**
  319. * @en The numeric keypad 0
  320. * @zh 数字键盘 0
  321. */
  322. NUM_0: 96,
  323. /**
  324. * @en The numeric keypad 1
  325. * @zh 数字键盘 1
  326. */
  327. NUM_1: 97,
  328. /**
  329. * @en The numeric keypad 2
  330. * @zh 数字键盘 2
  331. */
  332. NUM_2: 98,
  333. /**
  334. * @en The numeric keypad 3
  335. * @zh 数字键盘 3
  336. */
  337. NUM_3: 99,
  338. /**
  339. * @en The numeric keypad 4
  340. * @zh 数字键盘 4
  341. */
  342. NUM_4: 100,
  343. /**
  344. * @en The numeric keypad 5
  345. * @zh 数字键盘 5
  346. */
  347. NUM_5: 101,
  348. /**
  349. * @en The numeric keypad 6
  350. * @zh 数字键盘 6
  351. */
  352. NUM_6: 102,
  353. /**
  354. * @en The numeric keypad 7
  355. * @zh 数字键盘 7
  356. */
  357. NUM_7: 103,
  358. /**
  359. * @en The numeric keypad 8
  360. * @zh 数字键盘 8
  361. */
  362. NUM_8: 104,
  363. /**
  364. * @en The numeric keypad 9
  365. * @zh 数字键盘 9
  366. */
  367. NUM_9: 105,
  368. /**
  369. * @en The numeric keypad '*'
  370. * @zh 数字键盘 *
  371. */
  372. NUM_MULTIPLY: 106,
  373. /**
  374. * @en The numeric keypad '+'
  375. * @zh 数字键盘 +
  376. */
  377. NUM_PLUS: 107,
  378. /**
  379. * @en The numeric keypad '-'
  380. * @zh 数字键盘 -
  381. */
  382. NUM_SUBTRACT: 109,
  383. /**
  384. * @en The numeric keypad '.'
  385. * @zh 数字键盘小数点 '.'
  386. */
  387. NUM_DECIMAL: 110,
  388. /**
  389. * @en The numeric keypad '/'
  390. * @zh 数字键盘 /
  391. */
  392. NUM_DIVIDE: 111,
  393. /**
  394. * @en The F1 function key
  395. * @zh F1 功能键
  396. */
  397. F1: 112,
  398. /**
  399. * @en The F2 function key
  400. * @zh F2 功能键
  401. */
  402. F2: 113,
  403. /**
  404. * @en The F3 function key
  405. * @zh F3 功能键
  406. */
  407. F3: 114,
  408. /**
  409. * @en The F4 function key
  410. * @zh F4 功能键
  411. */
  412. F4: 115,
  413. /**
  414. * @en The F5 function key
  415. * @zh F5 功能键
  416. */
  417. F5: 116,
  418. /**
  419. * @en The F6 function key
  420. * @zh F6 功能键
  421. */
  422. F6: 117,
  423. /**
  424. * @en The F7 function key
  425. * @zh F7 功能键
  426. */
  427. F7: 118,
  428. /**
  429. * @en The F8 function key
  430. * @zh F8 功能键
  431. */
  432. F8: 119,
  433. /**
  434. * @en The F9 function key
  435. * @zh F9 功能键
  436. */
  437. F9: 120,
  438. /**
  439. * @en The F10 function key
  440. * @zh F10 功能键
  441. */
  442. F10: 121,
  443. /**
  444. * @en The F11 function key
  445. * @zh F11 功能键
  446. */
  447. F11: 122,
  448. /**
  449. * @en The F12 function key
  450. * @zh F12 功能键
  451. */
  452. F12: 123,
  453. /**
  454. * @en The numlock key
  455. * @zh 数字锁定键
  456. */
  457. NUM_LOCK: 144,
  458. /**
  459. * @en The scroll lock key
  460. * @zh 滚动锁定键
  461. */
  462. SCROLL_LOCK: 145,
  463. /**
  464. * @en The ';' key.
  465. * @zh 分号键
  466. */
  467. SEMICOLON: 186,
  468. /**
  469. * @en The '=' key.
  470. * @zh 等于号键
  471. */
  472. EQUAL: 187,
  473. /**
  474. * @en The ',' key.
  475. * @zh 逗号键
  476. */
  477. COMMA: 188,
  478. /**
  479. * @en The dash '-' key.
  480. * @zh 中划线键
  481. */
  482. DASH: 189,
  483. /**
  484. * @en The '.' key
  485. * @zh 句号键
  486. */
  487. PERIOD: 190,
  488. /**
  489. * @en The slash key '/'
  490. * @zh 正斜杠键 '/'
  491. */
  492. SLASH: 191,
  493. /**
  494. * @en The back quote key `
  495. * @zh 按键 `
  496. */
  497. BACK_QUOTE: 192,
  498. /**
  499. * @en The '[' key
  500. * @zh 按键 [
  501. */
  502. BRACKET_LEFT: 219,
  503. /**
  504. * @en The back slash key '\'
  505. * @zh 反斜杠键 '\'
  506. */
  507. BACKSLASH: 220,
  508. /**
  509. * @en The ']' key
  510. * @zh 按键 ]
  511. */
  512. BRACKET_RIGHT: 221,
  513. /**
  514. * @en The quote key
  515. * @zh 单引号键
  516. */
  517. QUOTE: 222,
  518. // #region The new allocated key enum since v3.3
  519. /**
  520. * @en The right shift key
  521. * @zh 右 Shift 键
  522. */
  523. SHIFT_RIGHT: 2000,
  524. /**
  525. * @en The right ctrl key
  526. * @zh 右 Ctrl 键
  527. */
  528. CTRL_RIGHT: 2001,
  529. /**
  530. * @en The right alt key
  531. * @zh 右 Alt 键
  532. */
  533. ALT_RIGHT: 2002,
  534. /**
  535. * @en The numeric keypad enter
  536. * @zh 数字键盘 enter
  537. */
  538. NUM_ENTER: 2003,
  539. // #endregion The new allocated key enum since v3.3
  540. };