MCPcopy Create free account
hub / github.com/corbanbrook/dsp.js / keyCodeMap

Function keyCodeMap

examples/js/processing.js:10735–10819  ·  view source on GitHub ↗
(code, shift)

Source from the content-addressed store, hash-verified

10733 //////////////////////////////////////////////////////////////////////////
10734
10735 function keyCodeMap(code, shift) {
10736 // Letters
10737 if (code >= 65 && code <= 90) { // A-Z
10738 // Keys return ASCII for upcased letters.
10739 // Convert to downcase if shiftKey is not pressed.
10740 if (shift) {
10741 return code;
10742 }
10743 else {
10744 return code + 32;
10745 }
10746 }
10747
10748 // Numbers and their shift-symbols
10749 else if (code >= 48 && code <= 57) { // 0-9
10750 if (shift) {
10751 switch (code) {
10752 case 49:
10753 return 33; // !
10754 case 50:
10755 return 64; // @
10756 case 51:
10757 return 35; // #
10758 case 52:
10759 return 36; // $
10760 case 53:
10761 return 37; // %
10762 case 54:
10763 return 94; // ^
10764 case 55:
10765 return 38; // &
10766 case 56:
10767 return 42; // *
10768 case 57:
10769 return 40; // (
10770 case 48:
10771 return 41; // )
10772 }
10773 }
10774 }
10775
10776 // Coded keys
10777 else if (codedKeys.indexOf(code) >= 0) { // SHIFT, CONTROL, ALT, LEFT, RIGHT, UP, DOWN
10778 p.keyCode = code;
10779 return p.CODED;
10780 }
10781
10782 // Symbols and their shift-symbols
10783 else {
10784 if (shift) {
10785 switch (code) {
10786 case 107:
10787 return 43; // +
10788 case 219:
10789 return 123; // {
10790 case 221:
10791 return 125; // }
10792 case 222:

Callers 1

processing.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected