1
1
import React from 'react' ;
2
2
import KeyModel from '../../../models/KeyModel' ;
3
- import { IKeymap } from '../../../services/hid/Hid' ;
3
+ import { IEncoderKeymaps , IKeymap } from '../../../services/hid/Hid' ;
4
4
import { KeycodeList } from '../../../services/hid/KeycodeList' ;
5
5
import { keyInfoList } from '../../../services/hid/KeycodeInfoList' ;
6
6
import { KeyLabelLangs } from '../../../services/labellang/KeyLabelLangs' ;
@@ -23,7 +23,7 @@ type OwnProps = {
23
23
// eslint-disable-next-line no-unused-vars
24
24
newKey : Key ,
25
25
// eslint-disable-next-line no-unused-vars
26
- oldKeycode : number ,
26
+ oldKeymap : IKeymap ,
27
27
// eslint-disable-next-line no-unused-vars
28
28
selectedLayer : number ,
29
29
// eslint-disable-next-line no-unused-vars
@@ -43,6 +43,7 @@ type OwnProps = {
43
43
) => void ;
44
44
keyModels : KeyModel [ ] ;
45
45
keymaps : { [ pos : string ] : IKeymap } ;
46
+ encodersKeymaps : IEncoderKeymaps ;
46
47
children ?: React . ReactNode | React . ReactNode [ ] ;
47
48
} ;
48
49
type KeyEventCaptureProps = OwnProps &
@@ -77,9 +78,18 @@ export default class KeyEventCapture extends React.Component<
77
78
return ;
78
79
}
79
80
81
+ let oldKeymap =
82
+ this . props . selectedKeySwitchOperation === 'click'
83
+ ? this . props . keymaps [ this . props . selectedPos ! ]
84
+ : this . props . selectedKeySwitchOperation === 'cw'
85
+ ? this . props . encodersKeymaps [ this . props . selectedEncoderId ! ] . clockwise
86
+ : this . props . selectedKeySwitchOperation === 'ccw'
87
+ ? this . props . encodersKeymaps [ this . props . selectedEncoderId ! ]
88
+ . counterclockwise
89
+ : undefined ;
80
90
this . props . onKeyDown ! (
81
91
newKey ,
82
- this . props . keymaps [ this . props . selectedPos ! ] . code ,
92
+ oldKeymap ! ,
83
93
this . props . selectedLayer ! ,
84
94
this . props . selectedPos ! ,
85
95
this . props . selectedEncoderId ! ,
0 commit comments