Home Reference Source

Function

Static Public Summary
public

distance(x1: number, y1: number, x2: number, y2: number): *

measure distance between two points

public

distancePointElement(x: number, y: number, element: HTMLElement): *

public

getChildIndex(parent: *, child: *): *

public

html(options: *): *

public

inside(dragging: HTMLElement, element: HTMLElement): *

determine whether the mouse is inside an element

public

options(options: object, defaults: object): object

combines options and default options

public

percentage(xa1: number, ya1: number, xa2: number, xa2: number, xb1: number, yb1: number, xb2: number, yb2: number): number

calculate percentage of overlap between two boxes from https://stackoverflow.com/a/21220004/1955997

public

removeChildren(element: *)

public

style(element: HTMLElement, style: string, value: string | string[])

set a style on an element

public

styles(object: *, styles: *)

public

toGlobal(e: HTMLElement): PointLike

determines global location of a div from https://stackoverflow.com/a/26230989/1955997

Static Public

public distance(x1: number, y1: number, x2: number, y2: number): * source

import {distance} from 'yy-tree/src/utils.js'

measure distance between two points

Params:

NameTypeAttributeDescription
x1 number
y1 number
x2 number
y2 number

Return:

*

public distancePointElement(x: number, y: number, element: HTMLElement): * source

import {distancePointElement} from 'yy-tree/src/utils.js'

find shortest distance from point to HTMLElement's bounding box from: https://gamedev.stackexchange.com/questions/44483/how-do-i-calculate-distance-between-a-point-and-an-axis-aligned-rectangle

Params:

NameTypeAttributeDescription
x number
y number
element HTMLElement

Return:

*

public getChildIndex(parent: *, child: *): * source

import {getChildIndex} from 'yy-tree/src/utils.js'

Params:

NameTypeAttributeDescription
parent *
child *

Return:

*

public html(options: *): * source

import {html} from 'yy-tree/src/utils.js'

Params:

NameTypeAttributeDescription
options *

Return:

*

public inside(dragging: HTMLElement, element: HTMLElement): * source

import {inside} from 'yy-tree/src/utils.js'

determine whether the mouse is inside an element

Params:

NameTypeAttributeDescription
dragging HTMLElement
element HTMLElement

Return:

*

public options(options: object, defaults: object): object source

import {options} from 'yy-tree/src/utils.js'

combines options and default options

Params:

NameTypeAttributeDescription
options object
defaults object

Return:

object

options+defaults

public percentage(xa1: number, ya1: number, xa2: number, xa2: number, xb1: number, yb1: number, xb2: number, yb2: number): number source

import {percentage} from 'yy-tree/src/utils.js'

calculate percentage of overlap between two boxes from https://stackoverflow.com/a/21220004/1955997

Params:

NameTypeAttributeDescription
xa1 number
ya1 number
xa2 number
xa2 number
xb1 number
yb1 number
xb2 number
yb2 number

Return:

number

public removeChildren(element: *) source

import {removeChildren} from 'yy-tree/src/utils.js'

Params:

NameTypeAttributeDescription
element *

public style(element: HTMLElement, style: string, value: string | string[]) source

import {style} from 'yy-tree/src/utils.js'

set a style on an element

Params:

NameTypeAttributeDescription
element HTMLElement
style string
value string | string[]

single value or list of possible values (test each one in order to see if it works)

public styles(object: *, styles: *) source

import {styles} from 'yy-tree/src/utils.js'

Params:

NameTypeAttributeDescription
object *
styles *

public toGlobal(e: HTMLElement): PointLike source

import {toGlobal} from 'yy-tree/src/utils.js'

determines global location of a div from https://stackoverflow.com/a/26230989/1955997

Params:

NameTypeAttributeDescription
e HTMLElement

Return:

PointLike