forked from flybywiresim/simbridge
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'flybywiresim:main' into mcdu-adjustments
- Loading branch information
Showing
25 changed files
with
21,316 additions
and
31,759 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
engine-strict=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
const McduFunctionalKeys = { | ||
Tab: 'DIR', | ||
Insert: 'PROG', | ||
Home: 'PERF', | ||
PageUp: 'INIT', | ||
Enter: 'DATA', | ||
NumpadEnter: 'DATA', | ||
Delete: 'FPLN', | ||
End: 'RAD', | ||
PageDown: 'FUEL', | ||
Escape: 'MENU', | ||
ShiftLeft: 'AIRPORT', | ||
ArrowLeft: 'PREVPAGE', | ||
ArrowRight: 'NEXTPAGE', | ||
ArrowUp: 'UP', | ||
ArrowDown: 'DOWN', | ||
Backspace: 'CLR', | ||
Space: 'SP', | ||
Minus: 'PLUSMINUS', | ||
NumpadSubtract: 'PLUSMINUS', | ||
NumpadAdd: 'PLUSMINUS', | ||
Period: 'DOT', | ||
NumpadDecimal: 'DOT', | ||
NumpadDivide: 'DIV', | ||
Slash: 'DIV', | ||
NumpadMultiply: 'OVFY', | ||
}; | ||
|
||
export class McduKeyboardEvents { | ||
constructor(socketSender) { | ||
this.socketSender = socketSender; | ||
this.mcduFunctionalKeys = McduFunctionalKeys; | ||
} | ||
|
||
getMcduKey = (keyEvent) => { | ||
// match mcdu L/R row input for F keys | ||
if (keyEvent.code.match(/F\d+/)) { | ||
const fn = parseInt(keyEvent.code.replace('F', '')); | ||
return fn <= 6 ? `L${fn}` : `R${fn - 6}`; | ||
} | ||
|
||
// match a-z | ||
if (keyEvent.code.match(/Key[A-Z]/)) { | ||
return keyEvent.code.replace('Key', '').toLocaleUpperCase(); | ||
} | ||
|
||
// match 0-9 | ||
if (keyEvent.code.match(/(Digit|Numpad)\d/i)) { | ||
return keyEvent.code.replace(/Digit|Numpad/i, ''); | ||
} | ||
|
||
// match mcdu function keys | ||
return this.mcduFunctionalKeys[keyEvent.code]; | ||
} | ||
|
||
onKeyboardInput = (keyEvent) => { | ||
//console.log('event', { key: keyEvent.key, code: keyEvent.code }); | ||
const key = this.getMcduKey(keyEvent); | ||
|
||
if (key) { | ||
keyEvent.preventDefault(); | ||
keyEvent.stopPropagation(); | ||
} else { | ||
return; | ||
} | ||
|
||
//console.log(`mcdu key: ${key}`); | ||
|
||
this.socketSender(`event:left:${key}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.