mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Tried to refactor more, snapped the brush preview to the pixel grid
This commit is contained in:
@ -6,6 +6,8 @@ function getCursorPosition(e) {
|
||||
if (e.pageX != undefined && e.pageY != undefined) {
|
||||
x = e.pageX;
|
||||
y = e.pageY;
|
||||
|
||||
console.log("passato di qui");
|
||||
}
|
||||
else {
|
||||
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
|
||||
@ -15,5 +17,5 @@ function getCursorPosition(e) {
|
||||
x -= canvas.offsetLeft;
|
||||
y -= canvas.offsetTop;
|
||||
|
||||
return [x,y];
|
||||
return [Math.round(x), Math.round(y)];
|
||||
}
|
Reference in New Issue
Block a user