Skip to content

Commit

Permalink
Update view.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Jul 7, 2023
1 parent 48e383b commit 52da31a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions source/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,15 @@ view.View = class {
const pointerMoveHandler = (e) => {
e.preventDefault();
e.stopImmediatePropagation();
const dx = e.clientX - this._mousePosition.x;
const dy = e.clientY - this._mousePosition.y;
this._mousePosition.moved = dx * dx + dy * dy > 0;
if (this._mousePosition.moved) {
const container = this._element('graph');
container.scrollTop = this._mousePosition.top - dy;
container.scrollLeft = this._mousePosition.left - dx;
if (this._mousePosition) {
const dx = e.clientX - this._mousePosition.x;
const dy = e.clientY - this._mousePosition.y;
this._mousePosition.moved = dx * dx + dy * dy > 0;
if (this._mousePosition.moved) {
const container = this._element('graph');
container.scrollTop = this._mousePosition.top - dy;
container.scrollLeft = this._mousePosition.left - dx;
}
}
};
const pointerUpHandler = (e) => {
Expand Down

0 comments on commit 52da31a

Please sign in to comment.