diff --git a/bg.js b/bg.js index 4fbfae0..17738a8 100644 --- a/bg.js +++ b/bg.js @@ -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 { diff --git a/content.js b/content.js index a86088e..b2c2f4b 100644 --- a/content.js +++ b/content.js @@ -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 {