Skip to content

Commit f6f7a13

Browse files
authored
Merge pull request #50 from japrescott/fixMousePostion
fix mousePosition
2 parents 5229c05 + b564276 commit f6f7a13

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Next
22

3+
- Fix an issue with the lasso position when the page is scrollable (#50)
4+
35
## v0.18.4
46

57
- Fix an issues when programmatically trying to `select()` or `hover()` non-existing points

src/lasso-manager/index.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const createLasso = (
101101
Math.random().toString(36).substring(2, 5) +
102102
Math.random().toString(36).substring(2, 5);
103103
initiator.id = `lasso-initiator-${id}`;
104-
initiator.style.position = 'absolute';
104+
initiator.style.position = 'fixed';
105105
initiator.style.display = 'flex';
106106
initiator.style.justifyContent = 'center';
107107
initiator.style.alignItems = 'center';
@@ -125,10 +125,7 @@ const createLasso = (
125125
const getMousePosition = (event) => {
126126
const { left, top } = element.getBoundingClientRect();
127127

128-
return [
129-
event.clientX - left + window.scrollX,
130-
event.clientY - top + window.scrollY,
131-
];
128+
return [event.clientX - left, event.clientY - top];
132129
};
133130

134131
window.addEventListener('mouseup', mouseUpHandler);

0 commit comments

Comments
 (0)