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

Make cursorForHandle and it's argument type accessible from outside BasicMouseHandler. #92

Merged
merged 1 commit into from Jul 21, 2020
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
32 changes: 16 additions & 16 deletions packages/datagrid/src/basicmousehandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let handle = Private.resizeHandleForHitTest(hit);

// Fetch the cursor for the handle.
let cursor = Private.cursorForHandle(handle);
let cursor = this.cursorForHandle(handle);

// Update the viewport cursor based on the part.
grid.viewport.node.style.cursor = cursor;
Expand Down Expand Up @@ -216,7 +216,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let handle = Private.resizeHandleForHitTest(hit);

// Fetch the cursor for the handle.
let cursor = Private.cursorForHandle(handle);
let cursor = this.cursorForHandle(handle);

// Handle horizontal resize.
if (handle === 'left' || handle === 'right' ) {
Expand Down Expand Up @@ -583,10 +583,23 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
grid.scrollBy(dx, dy);
}

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

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

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


/**
* The namespace for the module implementation details.
Expand Down Expand Up @@ -716,12 +729,6 @@ namespace Private {
export
type PressData = RowResizeData | ColumnResizeData | SelectData ;

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

/**
* Get the resize handle for a grid hit test.
*/
Expand Down Expand Up @@ -795,14 +802,6 @@ namespace Private {
return result;
}

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

/**
* A timer callback for the autoselect loop.
*
Expand Down Expand Up @@ -904,6 +903,7 @@ namespace Private {
/**
* A mapping of resize handle to cursor.
*/
export
const cursorMap = {
top: 'ns-resize',
left: 'ew-resize',
Expand Down