Skip to content

Commit

Permalink
fix: wrong position of drag helper position (fix #84) (#85)
Browse files Browse the repository at this point in the history
* fix: wrong position of drag helper position

* chore: apply code review

chore: rename variable from pos to helperRect

* chore: apply code review

chore: caching helperRect in mouse down handler

* chore: change helper position

* chore: remove unused property
  • Loading branch information
jajugoguma committed Jul 15, 2021
1 parent d0152f0 commit bb388ff
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/js/features/draggable.js
Expand Up @@ -205,10 +205,9 @@ var Draggable = defineClass(
var mousePosX = mousePos[0];
var mousePosY = mousePos[1];
var helperStyle = this.helperElement.style;
var pos = this.tree.rootElement.getBoundingClientRect();

helperStyle.top = mousePosY - pos.top + this.helperPos.y + 'px';
helperStyle.left = mousePosX - pos.left + this.helperPos.x + 'px';
helperStyle.top = mousePosY + window.pageYOffset + this.helperPos.y + 'px';
helperStyle.left = mousePosX + window.pageXOffset + this.helperPos.x + 'px';
helperStyle.display = '';
},

Expand Down

0 comments on commit bb388ff

Please sign in to comment.