12 lines
271 B
TypeScript
12 lines
271 B
TypeScript
|
export type Pos = {
|
||
|
x: number, y: number,
|
||
|
};
|
||
|
export type Box = Pos & {
|
||
|
width: number, height: number,
|
||
|
}
|
||
|
export function posInBox(box: Box, pos: Pos) {
|
||
|
return pos.x > box.x && pos.x < box.x + box.width
|
||
|
&& pos.y > box.y && pos.y < box.y + box.height
|
||
|
}
|
||
|
|