mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Allow Shift key to show alternate receiver actions for Windows/Linux
This commit is contained in:
@@ -270,21 +270,25 @@ class ReceiverEntry extends Component<ReceiverEntryProps, ReceiverEntryState> {
|
||||
, showAlternateAction: false
|
||||
};
|
||||
|
||||
window.addEventListener("keydown", ev => {
|
||||
if (ev.key === "Alt") {
|
||||
const handleActionKeyEvents = (ev: KeyboardEvent) => {
|
||||
if (ev.key === "Alt" || ev.key === "Shift") {
|
||||
this.setState({
|
||||
showAlternateAction: true
|
||||
});
|
||||
}
|
||||
});
|
||||
window.addEventListener("keyup", ev => {
|
||||
if (ev.key === "Alt") {
|
||||
this.setState({
|
||||
showAlternateAction: false
|
||||
// Only enable on keydown, otherwise disable
|
||||
showAlternateAction: ev.type === "keydown"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("keydown", handleActionKeyEvents);
|
||||
window.addEventListener("keyup", handleActionKeyEvents);
|
||||
|
||||
window.addEventListener("blur", () => {
|
||||
this.setState({
|
||||
showAlternateAction: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
this.handleCast = this.handleCast.bind(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user