Skip to content

Commit

Permalink
feat: add ctrl-shift to modifier keys
Browse files Browse the repository at this point in the history
  • Loading branch information
shayan-shojaei committed Feb 22, 2022
1 parent e7cea51 commit 9324fda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/Cell/Cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function Cell({
if (onClick === undefined) return;

let modifer: ModifierKey = undefined;
if (e.ctrlKey) {
if (e.ctrlKey && e.shiftKey) {
modifer = 'ctrl-shift';
} else if (e.ctrlKey) {
modifer = 'ctrl';
} else if (e.shiftKey) {
modifer = 'shift';
Expand Down
10 changes: 9 additions & 1 deletion src/utils/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ export type CellPosition = {
row: number;
column: number;
};

export type SelectionRange = {
fromRow: number;
toRow: number;
fromColumn: number;
toColumn: number;
};

export type ModifierKey = 'shift' | 'ctrl' | undefined;
export type DeselectionRange = {
fromRow: number;
toRow: number;
fromColumn: number;
toColumn: number;
};

export type ModifierKey = 'shift' | 'ctrl' | 'ctrl-shift' | undefined;

0 comments on commit 9324fda

Please sign in to comment.