Skip to content

Commit

Permalink
Update dragdrop and its tests to use pointer events
Browse files Browse the repository at this point in the history
  • Loading branch information
afshin committed Jul 27, 2022
1 parent 0a8b1f6 commit 360e65b
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 103 deletions.
2 changes: 0 additions & 2 deletions packages/dragdrop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"chai": "^4.3.4",
"css-loader": "^3.4.0",
"downlevel-dts": "^0.4.0",
"es6-promise": "^4.0.5",
"karma": "^6.3.4",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^2.1.1",
Expand All @@ -72,7 +71,6 @@
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-sourcemaps": "^0.6.3",
"simulate-event": "^1.4.0",
"style-loader": "^1.0.2",
"terser": "^5.7.1",
"tslib": "^2.3.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/dragdrop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,10 @@ export class Drag implements IDisposable {
handleEvent(event: Event): void {
switch (event.type) {
case 'pointermove':
this._evtMouseMove(event as MouseEvent);
this._evtPointerMove(event as PointerEvent);
break;
case 'pointerup':
this._evtMouseUp(event as MouseEvent);
this._evtPointerUp(event as PointerEvent);
break;
case 'keydown':
this._evtKeyDown(event as KeyboardEvent);
Expand Down Expand Up @@ -295,9 +295,9 @@ export class Drag implements IDisposable {
}

/**
* Handle the `'mousemove'` event for the drag object.
* Handle the `'pointermove'` event for the drag object.
*/
private _evtMouseMove(event: MouseEvent): void {
private _evtPointerMove(event: PointerEvent): void {
// Stop all input events during drag-drop.
event.preventDefault();
event.stopPropagation();
Expand All @@ -314,9 +314,9 @@ export class Drag implements IDisposable {
}

/**
* Handle the `'mouseup'` event for the drag object.
* Handle the `'pointerup'` event for the drag object.
*/
private _evtMouseUp(event: MouseEvent): void {
private _evtPointerUp(event: PointerEvent): void {
// Stop all input events during drag-drop.
event.preventDefault();
event.stopPropagation();
Expand Down
Loading

0 comments on commit 360e65b

Please sign in to comment.