18 lines
473 B
JavaScript
18 lines
473 B
JavaScript
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,
|
|
};
|
|
} |