Skip to content

Commit

Permalink
Merge pull request #167 from ibdafna/restore_getter
Browse files Browse the repository at this point in the history
Restore getter for _pressData
  • Loading branch information
blink1073 authored Apr 12, 2021
2 parents 4a19ea2 + f604887 commit bcb9734
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 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,8 +606,15 @@ class BasicMouseHandler implements DataGrid.IMouseHandler {
return Private.cursorMap[handle];
}

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

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

/**
Expand Down

0 comments on commit bcb9734

Please sign in to comment.