This repository has been archived on 2021-10-15. You can view files and clone it, but cannot push or open issues or pull requests.
2020-coding-projects/uno/client/helpers.js

18 lines
473 B
JavaScript
Raw Normal View History

2020-05-05 20:35:48 +00:00
export function isInRegion(x, y, region) {
return x >= region.x && x <= region.x + region.width &&
y >= region.y && y <= region.y + region.height;
}
export function getRelativeRegionCoordinates(x, y, region) {
return {
x: (x - region.x) / region.width,
y: (y - region.y) / region.height,
};
}
export function getAbsoluteRegionCoordinates(x, y, region, width, height) {
return {
x: 0,
y: 0,
};
}