Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid mouse handler: Expose pressData for subclasses #146

Merged
merged 2 commits into from
Jan 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions packages/datagrid/src/basicmousehandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,28 +599,36 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
grid.scrollBy(dx, dy);
}

/**
* Convert a resize handle into a cursor.
*/
cursorForHandle(handle: ResizeHandle): string {
return Private.cursorMap[handle];
}
/**
* Convert a resize handle into a cursor.
*/
cursorForHandle(handle: ResizeHandle): string {
return Private.cursorMap[handle];
}

/**
* Get the current pressData
*/
get pressData(): PressData.PressData | null {
return this._pressData;
}

private _disposed = false;
private _pressData: Private.PressData | null;
private _pressData: PressData.PressData | null = null;
}

/**
* A type alias for the resize handle types.
*/
export
type ResizeHandle = 'top' | 'left' | 'right' | 'bottom' | 'none';
export
type ResizeHandle = 'top' | 'left' | 'right' | 'bottom' | 'none';


/**
* The namespace for the module implementation details.
* The namespace for the pressdata.
*/
namespace Private {
export
namespace PressData {
/**
* A type alias for the row resize data.
*/
Expand Down Expand Up @@ -744,7 +752,13 @@ namespace Private {
*/
export
type PressData = RowResizeData | ColumnResizeData | SelectData ;
}

/**
* The namespace for the module implementation details.
*/
export
namespace Private {
/**
* Get the resize handle for a grid hit test.
*/
Expand Down Expand Up @@ -826,7 +840,7 @@ namespace Private {
* @param data - The select data of interest.
*/
export
function autoselect(grid: DataGrid, data: SelectData): void {
function autoselect(grid: DataGrid, data: PressData.SelectData): void {
// Bail early if the timeout has been reset.
if (data.timeout < 0) {
return;
Expand Down