Nutrient Web SDK

ReferenceTransformationMatrix

Interface TransformationMatrix

Matrix for affine 2D transformations.

Layout:

        // The values represent:

| a c e | // - (a,b) the x base vector | b d f | // - (c,d) the y base vector | 0 0 1 | // - (e,f) the origin // of the resulting coordinate system.

The third row is always [0 0 1], thus we don't store the values.

Interface

Hierarchy

ReadonlyInheritableImmutableRecordTransformationMatrix

Properties

a

Readonly
number

scaleX()

Default Value

1

b

Readonly
number

skewY()

Default Value

0

c

Readonly
number

skewX()

Default Value

0

d

Readonly
number

scaleY()

Default Value

1

e

Readonly
number

translateX()

Default Value

0

f

Readonly
number

translateY()

Default Value

0

Methods

  • Multiplies the point with the matrix to apply the transformation. Transforming a "point" means also applying any translation from the matrix.

    | x'| | a c e | | x | | y'| = | b d f | * | y | | 1 | | 0 0 1 | | 1 |

    Parameters

    __namedParameters[number, number]

    Returns

    [number, number]
  • Multiplies the vector with the matrix to apply the transformation. Transforming a "vector" does ignore the translation of the matrix.

    | x'| | a c e | | x | | y'| = | b d f | * | y | | 0 | | 0 0 1 | | 0 |

    Parameters

    __namedParameters[number, number]

    Returns

    [number, number]
  • Calculates the inverse matrix. This requires the determinant to be != 0, which is always granted since the matrix can only hold affine transformations (all affine transformations are easily invertible).

    We exploit the fact that the matrix is affine to speed things up.

  • Rotates the matrix by deg degrees in the xy-plane clockwise about the origin of the Cartesian coordinate system.

    Parameters

    degCWnumber
  • Applies a scaling to the matrix. If only sx is set and sy is undefined, we will scale x and y by sx.

    A scale of 1 does not modify a dimension.

         | sx  0  0 |
    

    M' = M * | 0 sy 0 | | 0 0 1 |

    Parameters

    sxnumber
    synumber
    Optional
  • Returns the matrix's values as a CSS transform string.

    Returns

    string
  • Multiplies current matrix values with a new transformation matrix.

    The transformation will be applied on the left side of the multiplication, so that they are applied in the order transform() is called.

    | a' c' e' | | a2 c2 e2 | | a c e | | b' d' f' | = | b2 d2 f2 | * | b d f | | 0 0 1 | | 0 0 1 | | 0 0 1 |

    Parameters

    a2number
    b2number
    c2number
    d2number
    e2number
    f2number
  • Applies a translation to the matrix

         | 1 0 tx |
    

    M' = M * | 0 1 ty | | 0 0 1 |

    Parameters

    __namedParameters{ x: number; y: number }

Immutable Record API

24

asImmutable

Deprecated
  • Deprecated

    Returns

    this

    Deprecated

    Not part of the collection API the Nutrient Web SDK supports. Build the value once, or use withMutations().

    See Also

    • Map#asImmutable

asMutable

Deprecated
  • Deprecated

    Returns

    this

    Deprecated

    Not part of the collection API the Nutrient Web SDK supports. Use withMutations().

    See Also

    • Map#asMutable

  • Returns a new instance of this Record type with all values set to their default values.

    Returns

    this
  • Returns a new instance of this Record type with the value for the specific key set to its default value.

    Type Parameters

    Kextends "b" | "a" | "c" | "d" | "e" | "f"

    Parameters

    keyK

    Returns

    this
  • Returns a new instance of this Record type with the value at the given key path removed.

    Also available as removeIn.

    Parameters

    keyPathIterable<unknown>

    Returns

    this
  • Parameters

    otherunknown

    Returns

    boolean
  • Returns the value associated with the provided key, which may be the default value defined when creating the Record factory function.

    If the requested key is not defined by this Record type, then notSetValue will be returned if provided. Note that this scenario would produce an error when using Flow or TypeScript.

    Type Parameters

    Kextends "b" | "a" | "c" | "d" | "e" | "f"

    Parameters

    keyK

    Returns

    { … }[K]
  • Parameters

    keyPathIterable<unknown>
    notSetValueunknown
    Optional

    Returns

    unknown
  • Parameters

    keyunknown

    Returns

    boolean
  • Parameters

    ...collections
    Partial<{ … }>[]

    Returns

    this
  • Parameters

    ...collections
    (Iterable<[string, unknown], any, any> | Partial<{ … }>)[]

    Returns

    this
  • Parameters

    keyPathIterable<unknown>
    ...collections
    (Iterable<[string, unknown], any, any> | Partial<{ … }>)[]

    Returns

    this
  • Parameters

    merger(previous?: unknown, next?: unknown, key?: string) => unknown
    ...collections
    (Iterable<[string, unknown], any, any> | Partial<{ … }>)[]

    Returns

    this

mergeIn

Deprecated
  • Deprecated

    Parameters

    keyPathIterable<unknown>
    ...collections
    (Iterable<[string, unknown], any, any> | Partial<{ … }>)[]

    Returns

    this

    Deprecated

    Not part of the collection API the Nutrient Web SDK supports. Use update() followed by merge().

  • Parameters

    merger(previous?: unknown, next?: unknown, key?: string) => unknown
    ...collections
    (Iterable<[string, unknown], any, any> | Partial<{ … }>)[]

    Returns

    this

removeIn

Deprecated
  • Deprecated

    Parameters

    keyPathIterable<unknown>

    Returns

    this

    Deprecated

    Not part of the collection API the Nutrient Web SDK supports. Use deleteIn(), or update() followed by delete().

  • Type Parameters

    Kextends "b" | "a" | "c" | "d" | "e" | "f"

    Parameters

    keyK
    value
    { … }[K]

    Returns

    this
  • Parameters

    keyPathIterable<unknown>
    valueunknown

    Returns

    this
  • Deeply converts this Record to equivalent native JavaScript Object.

    Note: This method may not be overridden. Objects with custom serialization to plain JS may override toJSON() instead.

    Returns

    { … }
    • a: number

      scaleX()

      Default Value

      1
    • b: number

      skewY()

      Default Value

      0
    • c: number

      skewX()

      Default Value

      0
    • d: number

      scaleY()

      Default Value

      1
    • e: number

      translateX()

      Default Value

      0
    • f: number

      translateY()

      Default Value

      0
  • Shallowly converts this Record to equivalent native JavaScript Object.

    Returns

    { … }
    • a: number

      scaleX()

      Default Value

      1
    • b: number

      skewY()

      Default Value

      0
    • c: number

      skewX()

      Default Value

      0
    • d: number

      scaleY()

      Default Value

      1
    • e: number

      translateX()

      Default Value

      0
    • f: number

      translateY()

      Default Value

      0

toSeq

Deprecated
  • Deprecated

    Returns

    Keyed<string, unknown>

    Deprecated

    Not part of the collection API the Nutrient Web SDK supports. Use entries().

  • Type Parameters

    Kextends "b" | "a" | "c" | "d" | "e" | "f"

    Parameters

    keyK
    updater
    (value: { … }[K]) => { … }[K]

    Returns

    this
  • Parameters

    keyPathIterable<unknown>
    notSetValueunknown
    updater(value: unknown) => unknown

    Returns

    this
  • Parameters

    keyPathIterable<unknown>
    updater(value: unknown) => unknown

    Returns

    this
  • Note: Not all methods can be used on a mutable collection or within withMutations! Only set may be used mutatively.

    Parameters

    mutator(mutable: this) => unknown

    Returns

    this

    See Also

    • Map#withMutations