fix(ui): floor canvas coords to prevent partial pixel offset rendering issues

This commit is contained in:
psychedelicious 2023-05-15 18:50:34 +10:00
parent e1e5266fc3
commit 835922ea8f

View File

@ -9,8 +9,12 @@ const calculateCoordinates = (
contentHeight: number,
scale: number
): Vector2d => {
const x = containerWidth / 2 - (containerX + contentWidth / 2) * scale;
const y = containerHeight / 2 - (containerY + contentHeight / 2) * scale;
const x = Math.floor(
containerWidth / 2 - (containerX + contentWidth / 2) * scale
);
const y = Math.floor(
containerHeight / 2 - (containerY + contentHeight / 2) * scale
);
return { x, y };
};