this might fix some of our pixel-alignment issues

Signed-off-by: Victor Seiji Hariki <victorseijih@gmail.com>
This commit is contained in:
Victor Seiji Hariki 2022-12-07 18:38:23 -03:00
parent 3373d2964e
commit 9a08408456
2 changed files with 7 additions and 6 deletions

View file

@ -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}
);

View file

@ -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),
};
}