detecting zoe enter and leave events

This commit is contained in:
Hanusiak Piotr 2021-12-01 14:48:14 +01:00
parent 936a6bfeec
commit eb95e2e483
7 changed files with 526 additions and 347 deletions

View file

@ -0,0 +1,27 @@
export class MathUtils {
/**
*
* @param p Position to check.
* @param r Rectangle to check the overlap against.
* @returns true is overlapping
*/
public static isOverlappingWithRectangle(
p: { x: number, y: number},
r: { x: number, y: number, width: number, height: number},
): boolean {
return (this.isBetween(p.x, r.x, r.x + r.width) && this.isBetween(p.y, r.y, r.y + r.height));
}
/**
*
* @param value Value to check
* @param min inclusive min value
* @param max inclusive max value
* @returns true if value is in <min, max>
*/
public static isBetween(value: number, min: number, max: number): boolean {
return (value >= min) && (value <= max);
}
}