API

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

CanvasCreator

Ƭ CanvasCreator: function

Type declaration:

▸ (options: CanvasCreatorOptions): Canvas

Parameters:

NameType

options


DeepReadonly

Ƭ DeepReadonly: T extends Primitive ? T : DeepReadonlyObject‹T›


DeepReadonlyObject

Ƭ DeepReadonlyObject: object

Type declaration:


DimensionInput

Ƭ DimensionInput: string | number | undefined | null


FontStyle

Ƭ FontStyle: "normal" | "italic" | "oblique"


FontVariant

Ƭ FontVariant: "normal" | "small-caps"


FontWeight

Ƭ FontWeight: "normal" | "bold" | "bolder" | "lighter" | 100 | "100" | 200 | "200" | 300 | "300" | 400 | "400" | 500 | "500" | 600 | "600" | 700 | "700" | 800 | "800" | 900 | "900"


Id

Ƭ Id: number | string


ImageClass

Ƭ ImageClass: object

Type declaration:


OnAreaSelectListener

Ƭ OnAreaSelectListener: function

Type declaration:

▸ (areaSelectEvent: AreaSelectEvent): boolean

Parameters:

NameType

areaSelectEvent


OnDragListener

Ƭ OnDragListener: function

Type declaration:

▸ (dragEvent: DragEvent): boolean

Parameters:

NameType

dragEvent


OnScaleListener

Ƭ OnScaleListener: function

Type declaration:

▸ (scaleEvent: ScaleEvent): boolean

Parameters:

NameType

scaleEvent


Primitive

Ƭ Primitive: string | number | boolean | undefined | null


RadiusInput

Ƭ RadiusInput: number | Partial‹Radius› | null | undefined


RectInput

Ƭ RectInput: RectObjectInput | number


RectLike

Ƭ RectLike: Rect | RectInput


SupportedDomPointerEvent

Ƭ SupportedDomPointerEvent: MouseEvent | WheelEvent | TouchEvent

Variables

Const DEBUG_POINTER_EVENTS

DEBUG_POINTER_EVENTS: false = false


Const DEFAULT_POINTER_COUNT

DEFAULT_POINTER_COUNT: 1 = 1


Const MATCH_PARENT

MATCH_PARENT: -1 = -1


Const PARENT_ID

PARENT_ID: -1 = -1


Const WHEEL_SCROLL_SPAN

WHEEL_SCROLL_SPAN: 100 = 100


Const WRAP_CONTENT

WRAP_CONTENT: -2 = -2


Const colorRegex

colorRegex: RegExp‹› = /^(?:#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2}))|(?:#([0-9a-f])([0-9a-f])([0-9a-f]))|(?:rgb((\d+),\s*(\d+),\s*(\d+)))|(?:rgba((\d+),\s*(\d+),\s*(\d+),\s*(\d*.?\d+)))$/i


Const defaultImageClass

defaultImageClass: undefined | object = (() => { try { // Browsers default return Image; } catch { return undefined; } })()


Const defaultLayoutProps

defaultLayoutProps: LayoutProps = new LayoutParams().asProps()


Const isBrowser

isBrowser: false | requestAnimationFrame & requestAnimationFrame = typeof window !== 'undefined' && window.requestAnimationFrame


Const supportedDomPointerEvents

supportedDomPointerEvents: ("touchmove" | "mousemove" | "mousedown" | "touchstart" | "mouseover" | "mouseenter" | "touchcancel" | "mouseout" | "mouseup" | "touchend" | "wheel")[] = [ 'touchmove', 'mousemove', 'mousedown', 'touchstart', 'mouseover', 'mouseenter', 'touchcancel', 'mouseout', 'mouseup', 'touchend', 'wheel', ]

Functions

Const calcDimension

calcDimension(dimension: Dimension, parentDimension: number): undefined | number

Parameters:

NameType

dimension

parentDimension

number

Returns: undefined | number


Const createEventDispatcher

createEventDispatcher(view: View): EventListener

Parameters:

NameType

view

Returns: EventListener


createLayoutMap

createLayoutMapK›(t: Record‹K, LayoutProps›): object

Type parameters:

K: string

Parameters:

NameType

t

Record‹K, LayoutProps

Returns: object


Const deepFreeze

deepFreezeT›(object: T): DeepReadonly‹T›

Type parameters:

T

Parameters:

NameType

object

T

Returns: DeepReadonly‹T›


Const defaultCanvasCreator

defaultCanvasCreator(__namedParameters: object): HTMLCanvasElement

Parameters:

__namedParameters: object

NameType

height

number

width

number

Returns: HTMLCanvasElement


Const domEventToPointerAction

domEventToPointerAction(event: Event): PointerAction | undefined

Parameters:

NameType

event

Event

Returns: PointerAction | undefined


Const existingNonParentDependency

existingNonParentDependency(id: undefined | Id): id is number

Parameters:

NameType

id

undefined | Id

Returns: id is number


Const fillPointerEventData

fillPointerEventData(pointerEvent: CanvasPointerEvent, view: View, event: Event): void

Parameters:

NameType

pointerEvent

view

event

Event

Returns: void


Const getBox

getBox(width: number, height: number, scale: number): object

Parameters:

NameType

width

number

height

number

scale

number

Returns: object

  • str: string = +

  • style: string = font-size: 1px; padding: ${isSafari() ? height * scale / 2 : 0}px ${Math.floor(width * scale / 2)}px; color: transparent; line-height: ${height * scale}px;


Const getElementOffset

getElementOffset(element: HTMLElement, offset: Offset): Offset

Parameters:

NameType

element

HTMLElement

offset

Returns: Offset


Const horizontalLayoutDependencies

horizontalLayoutDependencies(lp: LayoutParams): number[]

Parameters:

NameType

lp

Returns: number[]


Const isBright

isBright(color: Color): boolean

Parameters:

NameType

color

Returns: boolean


Const isChrome

isChrome(): boolean

Returns: boolean


Const isMouseEvent

isMouseEvent(event: Event): event is MouseEvent

Parameters:

NameType

event

Event

Returns: event is MouseEvent


Const isSafari

isSafari(): boolean

Returns: boolean


Const isTouchEvent

isTouchEvent(event: Event): event is TouchEvent

Parameters:

NameType

event

Event

Returns: event is TouchEvent


Const isWheelEvent

isWheelEvent(event: Event): event is WheelEvent

Parameters:

NameType

event

Event

Returns: event is WheelEvent


Const logPointerEvent

logPointerEvent(pointerEvent: CanvasPointerEvent): void

Parameters:

NameType

pointerEvent

Returns: void


Const logScreenshot

logScreenshot(view: View, scale: number): void

Parameters:

NameTypeDefault

view

-

scale

number

1

Returns: void


Const luminance

luminance(c: Color): number

Parameters:

NameType

c

Returns: number


Const mouseToPointer

mouseToPointer(event: MouseEvent, offset: Offset, canvasPointer: CanvasPointer): void

Parameters:

NameType

event

MouseEvent

offset

canvasPointer

Returns: void


Const noContextError

noContextError(): Error

Returns: Error


Const normalizeRadius

normalizeRadius(radius: RadiusInput): Radius

Parameters:

NameType

radius

Returns: Radius


Const parseColor

parseColor(colorString: string | undefined): typeof colorString extends undefined ? undefined : Color | undefined

Parameters:

NameType

colorString

string | undefined

Returns: typeof colorString extends undefined ? undefined : Color | undefined


Const parseDimension

parseDimension(value: DimensionInput): Dimension

Parameters:

NameType

value

Returns: Dimension


Const parseFont

parseFont(__namedParameters: object): string

Parameters:

__namedParameters: object

NameType

fontFamily

string

fontSize

number

fontStyle

undefined | "normal" | "italic" | "oblique"

fontVariant

undefined | "normal" | "small-caps"

fontWeight

undefined | "normal" | "bold" | "bolder" | "lighter" | 100 | "100" | 200 | "200" | 300 | "300" | 400 | "400" | 500 | "500" | 600 | "600" | 700 | "700" | 800 | "800" | 900 | "900"

Returns: string


Const registerEventDispatcher

registerEventDispatcher(element: Element, dispatcher: EventListener): (Anonymous function)

Parameters:

NameType

element

Element

dispatcher

EventListener

Returns: (Anonymous function)


Const removeDefaultProps

removeDefaultProps(props: LayoutProps): any

Parameters:

NameType

props

Returns: any


Const removeEqualProps

removeEqualProps(object: any, defaultObject: any): any

Parameters:

NameType

object

any

defaultObject

any

Returns: any


Const removeUndefinedProps

removeUndefinedProps(object: any): any

Parameters:

NameType

object

any

Returns: any


Const resolveDimensionDependencies

resolveDimensionDependenciesT›(children: T[], dependencySelector: function, context: Context): T[]

Type parameters:

T: ViewLike

Parameters:

children: T[]

dependencySelector: function

▸ (lp: LayoutParams): number[]

Parameters:

NameType

lp

context: Context

Returns: T[]


Const resolveLayoutParamsIds

resolveLayoutParamsIds(layoutParams: LayoutParams, context: Context): void

Parameters:

NameType

layoutParams

context

Returns: void


Const rgba

rgba(color: string, alpha: number): string

Parameters:

NameType

color

string

alpha

number

Returns: string


Const roundCoordinate

roundCoordinate(coordinate: number): number

Parameters:

NameType

coordinate

number

Returns: number


Const scaleImage

scaleImage(scaleType: ImageScaleType, imageWidth: number, imageHeight: number, innerWidth: number, innerHeight: number, rect: Rect): Rect

Parameters:

NameType

scaleType

imageWidth

number

imageHeight

number

innerWidth

number

innerHeight

number

rect

Returns: Rect


Const touchToPointer

touchToPointer(touch: Touch | null, offset: Offset, canvasPointer: CanvasPointer): void

Parameters:

NameType

touch

Touch | null

offset

canvasPointer

Returns: void


Const verticalLayoutDependencies

verticalLayoutDependencies(lp: LayoutParams): number[]

Parameters:

NameType

lp

Returns: number[]


Const xor

xor(a: boolean, b: boolean): boolean

Parameters:

NameType

a

boolean

b

boolean

Returns: boolean

Object literals

Const DefaultProps

DefaultProps: object

ABOVE

ABOVE: undefined = undefined

ALIGN_BOTTOM

ALIGN_BOTTOM: undefined = undefined

ALIGN_END

ALIGN_END: undefined = undefined

ALIGN_START

ALIGN_START: undefined = undefined

ALIGN_TOP

ALIGN_TOP: undefined = undefined

BELOW

BELOW: undefined = undefined

CENTER_HORIZONTAL

CENTER_HORIZONTAL: boolean = false

CENTER_VERTICAL

CENTER_VERTICAL: boolean = false

HEIGHT

HEIGHT: number = WRAP_CONTENT

IS_ABSOLUTE

IS_ABSOLUTE: boolean = false

IS_ANIMATED

IS_ANIMATED: boolean = false

MARGIN

MARGIN: Rect‹› = new Rect(0)

MAX_HEIGHT

MAX_HEIGHT: number = Number.MAX_SAFE_INTEGER

MAX_WIDTH

MAX_WIDTH: number = Number.MAX_SAFE_INTEGER

MIN_HEIGHT

MIN_HEIGHT: number = 0

MIN_WIDTH

MIN_WIDTH: number = 0

PADDING

PADDING: Rect‹› = new Rect(0)

TO_END_OF

TO_END_OF: undefined = undefined

TO_START_OF

TO_START_OF: undefined = undefined

WIDTH

WIDTH: number = WRAP_CONTENT

X

X: number = 0

Y

Y: number = 0


Const defaultFont

defaultFont: object

fontFamily

fontFamily: string = "Arial"

fontSize

fontSize: number = 12


Const defaultPaintOptions

defaultPaintOptions: object

font

font: string = parseFont(defaultFont)

lineDash

lineDash: never[] = []

lineRounding

lineRounding: boolean = false

lineWidth

lineWidth: number = 0

textAlign

textAlign: TextAlign = 'left' as TextAlign

textBaseline

textBaseline: TextBaseline = 'bottom' as TextBaseline

textDirection

textDirection: CanvasDirection = 'ltr' as CanvasDirection


Const zeroRadius

zeroRadius: object

bl

bl: number = 0

br

br: number = 0

tl

tl: number = 0

tr

tr: number = 0

Last updated