Skip to content

Commit e587607

Browse files
authored
Merge pull request #873 from yoichi/on-encoder-toggle
Update also selected keySwitchOperation on encoder toggle
2 parents 6134557 + 63177f5 commit e587607

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

src/components/configure/keycap/Keycap.container.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ export type KeycapStateType = ReturnType<typeof mapStateToProps>;
2121

2222
const mapDispatchToProps = (_dispatch: any) => {
2323
return {
24-
updateKeydiff: (
24+
onClickEncoderToggle: (
25+
pos: string,
26+
encoderId: number | null,
27+
keySwitchOperation: IKeySwitchOperation,
2528
isSelectedKey: boolean,
2629
orgKey: Key,
2730
dstKey: Key | null
@@ -34,6 +37,13 @@ const mapDispatchToProps = (_dispatch: any) => {
3437
// clear diff display
3538
_dispatch(KeydiffActions.clearKeydiff());
3639
}
40+
_dispatch(
41+
KeymapActions.updateSelectedKeyPosition(
42+
pos,
43+
encoderId,
44+
keySwitchOperation
45+
)
46+
);
3747
}
3848
},
3949
onClickKeycap: (

src/components/configure/keycap/Keycap.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,14 @@ export default class Keycap extends React.Component<
126126
? genKey(remap, this.props.labelLang!)
127127
: null;
128128

129-
this.props.updateKeydiff!(this.props.focus!, orgKey, dstKey);
129+
this.props.onClickEncoderToggle!(
130+
this.props.model.pos,
131+
this.props.model.encoderId,
132+
nextKeySwitchOperation,
133+
this.props.focus!,
134+
orgKey,
135+
dstKey
136+
);
130137
}
131138

132139
private getTargetKeymap(

0 commit comments

Comments
 (0)