Home Reference Source
import ComputedStyles from 'potassium-es/src/style/ComputedStyles.js'
public class | source

ComputedStyles

ComputedStyles holds the previous and computed declarations for a single Object3D

The computed styles are the combined output of a node's {AssignedStyles}, {LocalStyles}, and inherited computed parental styles.

Constructor Summary

Public Constructor
public

constructor(node: THREE.Object3D)

Member Summary

Public Members
public get

changes: Array<property{string}>: *

changes is used by the Stylist to know which styles need to be updated on the Three.Object3D

public

node: *

Method Summary

Public Methods
public

Iterate over the current declarations

public

computeStyles(assignedStyles: AssignedStyles, localStyles: LocalStyles, parentalComputedStyles: ComputedStyles)

Compute the final styles for a node:

  • apply the assigned styles
  • apply local styles that aren't assigned
  • apply inherited styles that aren't assigned or local
public

get(property: *): *

public

getBoolean(property: *, defaultValue: undefined): *

public

getNumber(property: *, defaultValue: undefined): *

public

getNumberArray(property: *, defaultValue: undefined, fillLength: undefined): *

public

getString(property: *, defaultValue: undefined): *

public

log(showVars: boolean)

Public Constructors

public constructor(node: THREE.Object3D) source

Params:

NameTypeAttributeDescription
node THREE.Object3D

Public Members

public get changes: Array<property{string}>: * source

changes is used by the Stylist to know which styles need to be updated on the Three.Object3D

Return:

Array<property{string}>

the declarations that changed since the last update

public node: * source

Public Methods

public * [Symbol.iterator]() source

Iterate over the current declarations

public computeStyles(assignedStyles: AssignedStyles, localStyles: LocalStyles, parentalComputedStyles: ComputedStyles) source

Compute the final styles for a node:

  • apply the assigned styles
  • apply local styles that aren't assigned
  • apply inherited styles that aren't assigned or local

Params:

NameTypeAttributeDescription
assignedStyles AssignedStyles
localStyles LocalStyles
parentalComputedStyles ComputedStyles
  • optional
  • default: null

TODO:

  • calculate relative units like `em`
  • handle the 'inherit' and 'reset' style values
  • handle inherited sub values like `border-top: 10px` inherited on top of `border: 0`
  • handle value methods like `calc()`

public get(property: *): * source

Params:

NameTypeAttributeDescription
property *

Return:

*

public getBoolean(property: *, defaultValue: undefined): * source

Params:

NameTypeAttributeDescription
property *
defaultValue undefined
  • optional
  • default: undefined

Return:

*

public getNumber(property: *, defaultValue: undefined): * source

Params:

NameTypeAttributeDescription
property *
defaultValue undefined
  • optional
  • default: undefined

Return:

*

public getNumberArray(property: *, defaultValue: undefined, fillLength: undefined): * source

Params:

NameTypeAttributeDescription
property *
defaultValue undefined
  • optional
  • default: undefined
fillLength undefined
  • optional
  • default: undefined

Return:

*

public getString(property: *, defaultValue: undefined): * source

Params:

NameTypeAttributeDescription
property *
defaultValue undefined
  • optional
  • default: undefined

Return:

*

public log(showVars: boolean) source

Params:

NameTypeAttributeDescription
showVars boolean
  • optional
  • default: false