mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Fixed canvas undoing bug
This commit is contained in:
@ -182,12 +182,14 @@ function resizeImageData (image, width, height, algorithm) {
|
||||
resize(image, result)
|
||||
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
function getPixelPosition(index) {
|
||||
let linearIndex = index / 4;
|
||||
let y = linearIndex / layers[0].canvasSize[0];
|
||||
let x = linearIndex - y * layers[0].canvasSize[0];
|
||||
function getPixelPosition(index) {
|
||||
let linearIndex = index / 4;
|
||||
let x = linearIndex % layers[0].canvasSize[0];
|
||||
let y = Math.floor(linearIndex / layers[0].canvasSize[0]);
|
||||
|
||||
return [x, y];
|
||||
}
|
||||
console.log("pos: " + x + ", " + y);
|
||||
|
||||
return [Math.round(x), Math.round(y)];
|
||||
}
|
Reference in New Issue
Block a user