import { Dimensions , ScaledSize , } from 'react-native' ; export class Point { constructor ( readonly x , readonly y ) { } static zero ( ) { return new Point ( 0 , 0 ) ; } static outscreen ( ) { return new Point ( - 999 , - 999 ) ; } public equals ( other ) { if ( ! other ) { return false ; } return this . x === other . x && this . y === other . y ; } } export class Size { constructor ( readonly width , readonly height ) { } static zero ( ) { return new Size ( 0 , 0 ) ; } public equals ( other ) { if ( ! other ) { return false ; } return this . width === other . width && this . height === other . height ; } } export class Frame { readonly origin : Point ; readonly size : Size ; constructor ( x , y , width , height ) { this . origin = new Point ( x , y ) ; this . size = new Size ( width , height ) ; } static zero ( ) { return new Frame ( 0 , 0 , 0 , 0 ) ; } static window ( ) { const window = Dimensions . get ( 'window' ) ; return new Frame ( 0 , 0 , window . width , window . height ) ; } static outscreen ( ) { const point = Point . outscreen ( ) ; return new Frame ( point . x , point . y , 0 , 0 ) ; } public equals ( other ) { if ( ! other ) { return false ; } return this . origin . equals ( other . origin ) && this . size . equals ( other . size ) ; } /**
     * Creates new frame aligned to left of other
     */ public leftOf ( other ) { return new Frame ( other . origin . x - this . size . width , this . origin . y , this . size . width , this . size . height ) ; } /**
     * Creates new frame aligned to top of other
     */ public topOf ( other ) { return new Frame ( this . origin . x , other . origin . y - this . size . height , this . size . width , this . size . height ) ; } /**
     * Creates new frame aligned to right of other
     */ public rightOf ( other ) { return new Frame ( other . origin . x + other . size . width , this . origin . y , this . size . width , this . size . height ) ; } /**
     * Creates new frame aligned to bottom of other
     */ public bottomOf ( other ) { return new Frame ( this . origin . x , other . origin . y + other . size . height , this . size . width , this . size . height ) ; } /**
     * Creates new frame centered horizontally to other
     */ public centerHorizontalOf ( other ) { return new Frame ( other . origin . x + ( other . size . width - this . size . width ) / 2 , this . origin . y , this . size . width , this . size . height ) ; } /**
     * Creates new frame centered vertically to other
     */ public centerVerticalOf ( other ) { return new Frame ( this . origin . x , other . origin . y + ( other . size . height - this . size . height ) / 2 , this . size . width , this . size . height ) ; } public centerOf ( other ) { return new Frame ( other . origin . x + ( other . size . width - this . size . width ) / 2 , other . origin . y + ( other . size . height - this . size . height ) / 2 , this . size . width , this . size . height ) ; } }