Skip to content

Commit

Permalink
Remove key handler
Browse files Browse the repository at this point in the history
  • Loading branch information
georgecwan committed Dec 15, 2023
1 parent 6209496 commit 8b6201a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 64 deletions.
24 changes: 0 additions & 24 deletions packages/iris-grid/src/IrisGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ import FilterInputField from './FilterInputField';
import {
ClearFilterKeyHandler,
CopyKeyHandler,
CopyCursorKeyHandler,
ReverseKeyHandler,
} from './key-handlers';
import {
Expand Down Expand Up @@ -529,8 +528,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
this.handleAdvancedMenuOpened = this.handleAdvancedMenuOpened.bind(this);
this.handleGotoRowOpened = this.handleGotoRowOpened.bind(this);
this.handleGotoRowClosed = this.handleGotoRowClosed.bind(this);
this.handleShowCopyCursor = this.handleShowCopyCursor.bind(this);
this.handleHideCopyCursor = this.handleHideCopyCursor.bind(this);
this.handleAdvancedMenuClosed = this.handleAdvancedMenuClosed.bind(this);
this.handleAggregationChange = this.handleAggregationChange.bind(this);
this.handleAggregationsChange = this.handleAggregationsChange.bind(this);
Expand Down Expand Up @@ -707,7 +704,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
];
if (canCopy) {
keyHandlers.push(new CopyKeyHandler(this));
keyHandlers.push(new CopyCursorKeyHandler(this));
}
const { dh } = model;
const mouseHandlers = [
Expand Down Expand Up @@ -2791,26 +2787,6 @@ export class IrisGrid extends Component<IrisGridProps, IrisGridState> {
this.setState({ isGotoShown: false });
}

handleShowCopyCursor(): void {
if (!this.grid) {
return;
}
const { copyCursor } = this.props;
const { cursor } = this.grid.state;
if (cursor !== copyCursor) {
this.isCopying = true;
this.grid.setState({ cursor: copyCursor });
}
}

handleHideCopyCursor(): void {
if (!this.grid) {
return;
}
this.isCopying = false;
this.grid.setState({ cursor: null });
}

handleAdvancedMenuClosed(columnIndex: number): void {
const { focusedFilterBarColumn, isFilterBarShown } = this.state;
if (
Expand Down
33 changes: 0 additions & 33 deletions packages/iris-grid/src/key-handlers/CopyCursorKeyHandler.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/iris-grid/src/key-handlers/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { default as CopyKeyHandler } from './CopyKeyHandler';
export { default as CopyCursorKeyHandler } from './CopyCursorKeyHandler';
export { default as ReverseKeyHandler } from './ReverseKeyHandler';
export { default as ClearFilterKeyHandler } from './ClearFilterKeyHandler';
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
actions.push({
title: 'Copy Column Name',
group: IrisGridContextMenuHandler.GROUP_COPY,
shortcutText: ContextActionUtils.isMacPlatform()
? 'Opt+Click'
: 'Alt+Click',
shortcutText: ContextActionUtils.isMacPlatform() ? '⌥Click' : 'Alt+Click',
action: () => {
copyToClipboard(model.textForColumnHeader(modelIndex) ?? '').catch(e =>
log.error('Unable to copy header', e)
Expand Down Expand Up @@ -636,7 +634,7 @@ class IrisGridContextMenuHandler extends GridMouseHandler {
title: 'Copy Cell',
group: IrisGridContextMenuHandler.GROUP_COPY,
shortcutText: ContextActionUtils.isMacPlatform()
? 'Opt+Click'
? 'Click'
: 'Alt+Click',
order: 10,
action: () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@ class IrisGridCopyCellMouseHandler extends GridMouseHandler {
return false;
}

onMove(): EventHandlerResult {
if (this.irisGrid.isCopying) {
onMove(
gridPoint: GridPoint,
_grid: Grid,
event: GridMouseEvent
): EventHandlerResult {
if (
event.altKey &&
!ContextActionUtils.isModifierKeyDown(event) &&
!event.shiftKey &&
gridPoint.column != null &&
(gridPoint.row != null || gridPoint.columnHeaderDepth != null)
) {
this.cursor = this.irisGrid.props.copyCursor;
return true;
}
Expand Down

0 comments on commit 8b6201a

Please sign in to comment.