Rect
Exports related to points, sizes, and rects.
type ApiEndpointIdRecord = Partial<Record<ApiEndpointId, string>>
type BestFrameRects = ArrayOf3<Rect, RectTuple, RectOrNot>
interface ChangingRect {
changes?: ScalarsById
clickedNumbers: NumberRecord
moveHandler: PointerEventHandler
moved?: boolean
/** offset relative to container rect */
offsetPoint: Point
pointFlipping: boolean
pointTweening: boolean
}
interface ChangingSize
extends ChangingRect {
changes?: ScalarsById
clickedNumbers: NumberRecord
clickedPreviewPoint: Point
clickedRect: Rect
direction: string
moveHandler: PointerEventHandler
moved?: boolean
/** offset relative to container rect */
offsetPoint: Point
pointFlipping: boolean
pointTweening: boolean
sizeFlipping: boolean
sizeTweening: boolean
}
type CornerDirection = 'top_right' | 'top_left' | 'bottom_right' | 'bottom_left'
type Direction = SideDirection | CornerDirection
/**
* Supports a subset of the standard URL
* interface
*/
interface Endpoint {
/** full domain name if defined */
hostname?: string
/** relative or absolute path if defined */
pathname?: string
/** does not include ':' prefix */
port?: number
/** includes ':' suffix if defined */
protocol?: string
/** includes '?' prefix if defined */
search?: string
}
interface Endpoints
extends Record<string, StringRecord> {}
interface Point {
x: T
y: T
}
type PointKey = 'x' | 'y'
interface PointTuple
extends ArrayOf2<Point<T>, Point<T>> {}
interface Rect
extends Size<T>, Point<T> {}
interface RectOptions
extends SizeOptions, Partial<Point> {
lock?: SizeLock
shortest?: SizeKey
}
type RectOrNot = Rect | undefined
interface RectTuple
extends ArrayOf2<Rect<T>, Rect<T>> {}
type Rounding = 'ceil' | 'floor' | 'round'
type SideDirection = 'top' | 'right' | 'bottom' | 'left'
interface SideDirectionRecord
extends Record<SideDirection, BooleanOrNot> {}
interface Size {
height: T
width: T
}
type SizeKey = 'width' | 'height'
type SizeLock = SizeKey | 'longest' | 'none' | 'shortest'
interface SizeOptions
extends Partial<Size> {
lock?: SizeLock
shortest?: SizeKey
}
interface SizeTuple
extends ArrayOf2<Size<T>, Size<T>> {}
function contentPoints(
tweenRects: RectTuple,
intrinsicSize: Size,
containerRects: RectTuple,
outputSize: Size,
sizeAspect: Aspect,
pointAspect: Aspect,
rounding: Rounding,
sizeKey?: SizeKey
): PointTuple
function pixelFromFrame(
frame: number,
perFrame: number,
rounding?: Rounding
): number
function pixelPerFrame(
frames: number,
width: number,
zoom?: number
): number
function pixelToFrame(
pixels: number,
perFrame: number,
rounding: Rounding
): number
function pixelsFromDuration(
duration: number
): number
function pointCenter(
size: Size,
inSize: Size
): Point
function pointCopy<T = Primitive>(
from: Point<T>,
to?: Point<T>
): Point<T>
function pointNumber(
point: EvalPoint
): Point
function pointOrient<T = Primitive>(
tweenPoint: Point<T>,
outputSize: Size,
pointAspect: Aspect
): Point<T>
function pointRound(
point: Point,
rounding: Rounding
): Point
function pointString(
point: Point
): string
function pointTranslate(
point: Point,
translate: Point,
negate: boolean
): Point
function pointValueString(
point: Point
): string
function pointsEqual(
point: Point,
pointEnd?: unknown
): boolean
function rectCopy<T = Primitive>(
from: Rect<T>,
to?: Rect<T>
): Rect<T>
function rectTransformAttribute(
dimensions: Rect | Size,
rect: Rect
): string
function rectsEqual(
rect: Rect,
rectEnd: unknown
): boolean
function rectsUnion(
rects: Array<Rect>
): Rect
function roundWithMethod(
number: number,
rounding?: Rounding
): number
function sizeChange(
size: Size,
width?: number,
height?: number
): Size
/**
* Returns scaled inSize to just fit within
* outSize.
*/
function sizeContain(
inSize: Size,
outSize: Size | number
): Size
function sizeCopy<T = Primitive>(
from: Size<T>,
to?: Size<T>
): Size<T>
/**
* Returns inSize scaled to fit within
* outSize with minimal, or no cropping.
*/
function sizeCover(
inSize: Size,
outSize: Size,
dontCrop?: boolean
): Size
function sizeEven(
size: Size,
rounding: Rounding
): Size
function sizeFlip<T = Primitive>(
size: Size<T>
): Size<T>
function sizeFromElement(
element: Element
): Size
function sizeLock<T = Primitive>(
size: Size<T>,
sizeKey?: SizeKey
): Size<T>
/** Type guard for Size */
function sizeNotZero(
size: unknown
): boolean
function sizeNumber(
size: EvalSize
): Size
function sizeString(
size: Size
): string
function sizeValid(
size: Size
): boolean
function sizeValueString(
size: Size
): string
function sizesEqual<T = Primitive>(
size: Size<T>,
sizeEnd: Size<T>
): boolean
function textRect(
args: TextRectArgs
): DataOrError<Rect>