@@ -4,7 +4,7 @@ import { device } from '@/libs/device';
44import { Modifiers } from '@/libs/device/keyboard.ts' ;
55import { KeyboardCodes } from '@/libs/keyboard' ;
66
7- const MAX_SIMULTANEOUS_KEYS = 4 ;
7+ const MAX_SIMULTANEOUS_KEYS = 6 ;
88const ModifierKeys = new Set ( [ 'Control' , 'Shift' , 'Alt' , 'Meta' ] ) ;
99
1010export const Keyboard = ( ) => {
@@ -44,7 +44,7 @@ export const Keyboard = () => {
4444 }
4545 }
4646
47- await sendKeyData ( event ) ;
47+ await sendKeyData ( ) ;
4848 }
4949
5050 // release button
@@ -61,7 +61,7 @@ export const Keyboard = () => {
6161 }
6262 }
6363
64- await sendKeyData ( event ) ;
64+ await sendKeyData ( ) ;
6565 }
6666
6767 // release all keys when page loses focus
@@ -86,11 +86,13 @@ export const Keyboard = () => {
8686 }
8787
8888 // send keyboard data
89- async function sendKeyData ( event : KeyboardEvent ) {
90- const modifiers = Modifiers . getModifiers ( event , pressedModifiersRef . current ) ;
89+ async function sendKeyData ( ) {
90+ const modifiers = new Modifiers ( ) ;
91+ pressedModifiersRef . current . forEach ( ( code ) => {
92+ modifiers . setModifier ( code ) ;
93+ } ) ;
94+
9195 const keys = [
92- 0x00 ,
93- 0x00 ,
9496 ...Array . from ( pressedKeysRef . current ) ,
9597 ...new Array ( MAX_SIMULTANEOUS_KEYS - pressedKeysRef . current . size ) . fill ( 0x00 )
9698 ] ;
0 commit comments