Remove ctrl to stop drawing children
Summary: This feature is annoying and useless Reviewed By: antonk52 Differential Revision: D45696921 fbshipit-source-id: 01c007d3e196a7511b940b7973bb8e6a880e27e5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
da268f0095
commit
0f9eeda2dd
@@ -1,29 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {useEffect, useState} from 'react';
|
||||
|
||||
export function useKeyboardModifiers() {
|
||||
const [state, setState] = useState({altPressed: false, ctrlPressed: false});
|
||||
|
||||
function handler(event: KeyboardEvent) {
|
||||
setState({altPressed: event.altKey, ctrlPressed: event.ctrlKey});
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
window.addEventListener('keydown', handler);
|
||||
window.addEventListener('keyup', handler);
|
||||
return () => {
|
||||
window.removeEventListener('keydown', handler);
|
||||
window.removeEventListener('keyup', handler);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return state;
|
||||
}
|
||||
Reference in New Issue
Block a user