Nutrient Web SDK
    Preparing search index...

    A size is a 2D vector that describes the size of an element. It has the values width and height. Provided values are defined in same units used by the page, point units. Point units are only equal to pixels when zoom value is 1.

    It is an https://facebook.github.io/immutable-js/docs/#/Record|Immutable.Record and thus can be updated using set(key, value), for example: size.set("width", 20).

    Create and update a size.

    const size = new NutrientViewer.Geometry.Size({ width: 200, height: 100 });
    size = size.set("height", 200);
    size.height; // => 200

    An object used to initialize the size. If width or height is omitted, 0 will be used instead.

    { width: 0, height: 0 }
    

    Hierarchy

    • Record<{ height: number; width: number }, this> & Readonly<
          { height: number; width: number },
      >
      • Size
    Index

    Constructors

    • Parameters

      • Optionalvalues: Iterable<[string, any]> | Partial<{ height: number; width: number }>

      Returns NutrientViewer.Geometry.Size

    Properties

    height: number

    The height of the size.

    0
    
    width: number

    The width of the size.

    0
    

    Methods

    • Returns IterableIterator<["width" | "height", number]>

    • Returns this

      Map#asImmutable

    • Returns this

      Map#asMutable

    • Returns a new size with width and height rounded to a number which is greater than or equal to the current value.

      Returns NutrientViewer.Geometry.Size

      A new Size.

      var size = new NutrientViewer.Geometry.Size({ width: 20.5, height: 30.1 });
      size.ceil(); // => Size {width: 21, height: 31}
    • 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

      • K extends "width" | "height"

      Parameters

      • key: K

      Returns this

      remove

    • Parameters

      Returns this

      removeIn

    • Parameters

      • other: any

      Returns boolean

    • Returns a new size with width and height rounded to a number which is smaller than or equal to the current value.

      Returns NutrientViewer.Geometry.Size

      A new Size.

      var size = new NutrientViewer.Geometry.Size({ width: 20.5, height: 30.1 });
      size.floor(); // => Size {width: 20, height: 30}
    • 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

      • K extends "width" | "height"

      Parameters

      • key: K
      • OptionalnotSetValue: any

      Returns { height: number; width: number }[K]

    • Type Parameters

      • T

      Parameters

      • key: string
      • notSetValue: T

      Returns T

    • Parameters

      Returns any

    • Parameters

      • key: string

      Returns key is "width" | "height"

    • Returns number

    • Parameters

      Returns boolean

    • Parameters

      • ...collections: (Iterable<[string, any]> | Partial<{ height: number; width: number }>)[]

      Returns this

    • Parameters

      • ...collections: (Iterable<[string, any]> | Partial<{ height: number; width: number }>)[]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (oldVal: any, newVal: any, key: any) => any
      • ...collections: (Iterable<[string, any]> | Partial<{ height: number; width: number }>)[]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • ...collections: any[]

      Returns this

    • Parameters

      • merger: (oldVal: any, newVal: any, key: "width" | "height") => any
      • ...collections: (Iterable<[string, any]> | Partial<{ height: number; width: number }>)[]

      Returns this

    • Type Parameters

      • K extends "width" | "height"

      Parameters

      • key: K

      Returns this

    • Parameters

      Returns this

    • Scales the width and height by a given factor.

      Parameters

      • factor: number

        The scale factor.

      Returns NutrientViewer.Geometry.Size

      A new Size.

      var size = new NutrientViewer.Geometry.Size({ width: 20, height: 30 });
      size.scale(2); // => Size {width: 40, height: 60}
    • Type Parameters

      • K extends "width" | "height"

      Parameters

      • key: K
      • value: { height: number; width: number }[K]

      Returns this

    • Parameters

      Returns this

    • Returns a new size with the width set to the current height value and the height set to the current width value.

      Returns NutrientViewer.Geometry.Size

      A new Size.

      var size = new NutrientViewer.Geometry.Size({ width: 20.5, height: 30.1 });
      size.swapDimensions(); // => Size {width: 30.1, height: 20.5}
    • 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 { height: any; width: any }

      • height: any

        The height of the size.

        0
        
      • width: any

        The width of the size.

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

      Returns { height: number; width: number }

      • height: number

        The height of the size.

        0
        
      • width: number

        The width of the size.

        0
        
    • Shallowly converts this Record to equivalent JavaScript Object.

      Returns { height: number; width: number }

      • height: number

        The height of the size.

        0
        
      • width: number

        The width of the size.

        0
        
    • Returns Keyed<"width" | "height", number>

    • Type Parameters

      • K extends "width" | "height"

      Parameters

      • key: K
      • updater: (
            value: { height: number; width: number }[K],
        ) => { height: number; width: number }[K]

      Returns this

    • Parameters

      • keyPath: Iterable<any>
      • updater: (value: any) => any

      Returns this

    • Returns boolean

      Map#wasAltered

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

      Parameters

      • mutator: (mutable: this) => any

      Returns this

      Map#withMutations