mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-22 01:24:21 +01:00
* Initial implementation of shift and ctrl click to select * Implement shift-ctrl selection * Fix snapshot, update selectionHelper comment * Fix missing type * Properly disable cursor selection * Update snapshots * Do not enable (multiselect) if readonly * Consider meta key for mac and ctrl for everything else
16 lines
703 B
TypeScript
16 lines
703 B
TypeScript
/**
|
|
* Is the environment 'ctrl' key press. This key is used for multi selection, like select one more item, select all.
|
|
* For Windows and Linux, it's ctrl. For Mac, it's command.
|
|
*/
|
|
export const isEnvironmentCtrlPressed = (event: JQueryEventObject | React.MouseEvent): boolean =>
|
|
isMac() ? event.metaKey : event.ctrlKey;
|
|
|
|
export const isEnvironmentShiftPressed = (event: JQueryEventObject | React.MouseEvent): boolean => event.shiftKey;
|
|
|
|
export const isEnvironmentAltPressed = (event: JQueryEventObject | React.MouseEvent): boolean => event.altKey;
|
|
|
|
/**
|
|
* Returns whether the current platform is MacOS.
|
|
*/
|
|
export const isMac = (): boolean => navigator.platform.toUpperCase().indexOf("MAC") >= 0;
|