diff --git a/web/apps/photos/thirdparty/face-api/classes/Box.ts b/web/apps/photos/thirdparty/face-api/classes/Box.ts index e88275401e..fcf1cbebb3 100644 --- a/web/apps/photos/thirdparty/face-api/classes/Box.ts +++ b/web/apps/photos/thirdparty/face-api/classes/Box.ts @@ -1,4 +1,3 @@ -import { isDimensions, isValidNumber } from '../utils'; import { IBoundingBox } from './BoundingBox'; import { IDimensions } from './Dimensions'; import { Point } from './Point'; @@ -172,4 +171,12 @@ export class Box implements IBoundingBox, IRect { bottom: this.bottom + (region.bottom * this.height) }).toSquare().round() } -} \ No newline at end of file +} + +export function isValidNumber(num: any) { + return !!num && num !== Infinity && num !== -Infinity && !isNaN(num) || num === 0 +} + +export function isDimensions(obj: any): boolean { + return obj && obj.width && obj.height +} diff --git a/web/apps/photos/thirdparty/face-api/classes/Dimensions.ts b/web/apps/photos/thirdparty/face-api/classes/Dimensions.ts index e0b61ed106..0129f3b678 100644 --- a/web/apps/photos/thirdparty/face-api/classes/Dimensions.ts +++ b/web/apps/photos/thirdparty/face-api/classes/Dimensions.ts @@ -1,4 +1,4 @@ -import { isValidNumber } from '../utils'; +import { isValidNumber } from './Box'; export interface IDimensions { width: number @@ -25,4 +25,4 @@ export class Dimensions implements IDimensions { public reverse(): Dimensions { return new Dimensions(1 / this.width, 1 / this.height) } -} \ No newline at end of file +}