Skip to content

Commit

Permalink
fix canvas width and selection 'x' coordinate
Browse files Browse the repository at this point in the history
  • Loading branch information
kabuspl committed Dec 11, 2022
1 parent 550735a commit 0a8fb93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions bg.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function searchBlob (img, msg) {

imgEl.onload = () => {
if (msg) {
width = msg.x2 - msg.x1;
height = msg.y2 - msg.y1;
width = Math.abs(msg.x2 - msg.x1);
height = Math.abs(msg.y2 - msg.y1);
x -= msg.x1;
y -= msg.y1;
} else {
Expand Down
2 changes: 1 addition & 1 deletion content.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ cont.addEventListener("touchmove", e => {
function stopSelection(x,y) {
down = false;
let x1, y1, x2, y2;
if (y - startX < 0) {
if (x - startX < 0) {
x1 = x;
x2 = startX;
} else {
Expand Down

0 comments on commit 0a8fb93

Please sign in to comment.