diff --git a/js/initalize/layers.populate.js b/js/initalize/layers.populate.js index 9263dfe..2eb35a0 100644 --- a/js/initalize/layers.populate.js +++ b/js/initalize/layers.populate.js @@ -80,8 +80,8 @@ mouse.registerContext( // ctx.coords.prev.x = ctx.coords.pos.x; ctx.coords.prev.y = ctx.coords.pos.y; - ctx.coords.pos.x = layerX; - ctx.coords.pos.y = layerY; + ctx.coords.pos.x = Math.round(layerX); + ctx.coords.pos.y = Math.round(layerY); }, {target: imageCollection.inputElement} ); diff --git a/js/lib/util.js b/js/lib/util.js index bdd0a63..0f80380 100644 --- a/js/lib/util.js +++ b/js/lib/util.js @@ -180,14 +180,15 @@ function getBoundingBox(cx, cy, w, h, gridSnap = null, offset = 0) { offs.x = snap(cx, offset, gridSnap); offs.y = snap(cy, offset, gridSnap); } - box.x = offs.x + cx; - box.y = offs.y + cy; + + box.x = Math.round(offs.x + cx); + box.y = Math.round(offs.y + cy); return { x: Math.floor(box.x - w / 2), y: Math.floor(box.y - h / 2), - w, - h, + w: Math.round(w), + h: Math.round(h), }; }