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

Change one BasicMouseHandler properties from private to protected #161

Merged
merged 3 commits into from
Mar 31, 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
31 changes: 12 additions & 19 deletions packages/datagrid/src/basicmousehandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
*/
release(): void {
// Bail early if the is no press data.
if (!this._pressData) {
if (!this.pressData) {
return;
}

// Clear the autoselect timeout.
if (this._pressData.type === 'select') {
this._pressData.timeout = -1;
if (this.pressData.type === 'select') {
this.pressData.timeout = -1;
}

// Clear the press data.
this._pressData.override.dispose();
this._pressData = null;
this.pressData.override.dispose();
this.pressData = null;
}

/**
Expand Down Expand Up @@ -162,7 +162,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let override = Drag.overrideCursor('default');

// Set up the press data.
this._pressData = {
this.pressData = {
type: 'select', region, row, column, override,
localX: -1, localY: -1, timeout: -1
};
Expand Down Expand Up @@ -241,7 +241,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let override = Drag.overrideCursor(cursor);

// Create the temporary press data.
this._pressData = { type, region: rgn, index, size, clientX, override };
this.pressData = { type, region: rgn, index, size, clientX, override };

// Done.
return;
Expand All @@ -267,7 +267,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let override = Drag.overrideCursor(cursor);

// Create the temporary press data.
this._pressData = { type, region: rgn, index, size, clientY, override };
this.pressData = { type, region: rgn, index, size, clientY, override };

// Done.
return;
Expand All @@ -287,7 +287,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
let override = Drag.overrideCursor('default');

// Set up the press data.
this._pressData = {
this.pressData = {
type: 'select', region, row, column, override,
localX: -1, localY: -1, timeout: -1
};
Expand Down Expand Up @@ -362,7 +362,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
*/
onMouseMove(grid: DataGrid, event: MouseEvent): void {
// Fetch the press data.
const data = this._pressData;
const data = this.pressData;

// Bail early if there is no press data.
if (!data) {
Expand Down Expand Up @@ -570,7 +570,7 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
*/
onWheel(grid: DataGrid, event: WheelEvent): void {
// Bail if a mouse press is in progress.
if (this._pressData) {
if (this.pressData) {
return;
}

Expand Down Expand Up @@ -606,15 +606,8 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
return Private.cursorMap[handle];
}

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this mean that this property will not be available on the public API anymore ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed. Can this be added back?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyone able to make a PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll submit one

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blink1073 to revert this, I'll need to restore the variable name of pressData back to _pressData as the get pressData() and pressData attribute have duplicate identifiers. Unless you have other suggestions?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in #167

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

/**
Expand Down