Skip to content

Commit

Permalink
fixed mouse pos
Browse files Browse the repository at this point in the history
  • Loading branch information
leomcelroy committed Jan 25, 2022
1 parent de2e3c6 commit a47a174
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ class Engine {
return this._height;
}
get mouseX() {
return this._mouseX;
const rect = this.canvas.getBoundingClientRect();
return this._mouseX - rect.left;
} // not doced
get mouseY() {
return this._mouseY;
const rect = this.canvas.getBoundingClientRect();
return this._mouseY - rect.top;
} // not doced

add(params) {
Expand Down

0 comments on commit a47a174

Please sign in to comment.