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 the Drag class's private method _moveDragImage to a public method moveDragImage. #96

Merged
merged 2 commits into from Jul 27, 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
30 changes: 15 additions & 15 deletions packages/dragdrop/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,20 @@ class Drag implements IDisposable {
}
}

/**
* Move the drag image element to the specified location.
*
* This is a no-op if there is no drag image element.
*/
protected moveDragImage(clientX: number, clientY: number): void {
if (!this.dragImage) {
return;
}
let style = this.dragImage.style;
style.top = `${clientY}px`;
style.left = `${clientX}px`;
}

/**
* Handle the `'mousemove'` event for the drag object.
*/
Expand All @@ -297,7 +311,7 @@ class Drag implements IDisposable {

// Move the drag image to the specified client position. This is
// performed *after* dispatching to prevent unnecessary reflows.
this._moveDragImage(event.clientX, event.clientY);
this.moveDragImage(event.clientX, event.clientY);
}

/**
Expand Down Expand Up @@ -469,20 +483,6 @@ class Drag implements IDisposable {
document.body.appendChild(this.dragImage);
}

/**
* Move the drag image element to the specified location.
*
* This is a no-op if there is no drag image element.
*/
private _moveDragImage(clientX: number, clientY: number): void {
if (!this.dragImage) {
return;
}
let style = this.dragImage.style;
style.top = `${clientY}px`;
style.left = `${clientX}px`;
}

/**
* Detach the drag image element from the DOM.
*
Expand Down