Nutrient Web SDK
    Preparing search index...

    An inset describes a rectangle by enumerating the distance from each side to the corresponding side of a reference rectangle. Therefore it does not hold coordinates, nor dimensions, only relative values for left, top, right and bottom. 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 Immutable.Record and thus can be updated using set(key, value), for example: inset.set("right", 15).

    Create and update an inset.

    const inset = new NutrientViewer.Geometry.Inset({
    left: 5,
    top: 15,
    right: 10,
    bottom: 5
    });
    inset = inset.set("bottom", 7);
    rect.bottom; // => 7

    An object used to initialize the Point. If left, top, right or bottom is omitted, 0 will be used instead.

    { left: 0, top: 0, right: 0, bottom: 0 }
    

    Hierarchy

    • Readonly<InsetData>
    • __dangerousImmutableRecordFactory<
          { bottom: number; left: number; right: number; top: number },
          this,
      >
      • Inset
    Index

    Constructors

    • Parameters

      • Optionaloptions: { bottom?: number; left?: number; right?: number; top?: number }
        • Optionalbottom?: number

          The bottom distance of the inset.

          0
          
        • Optionalleft?: number

          The left distance of the inset. This is equivalent to x of a NutrientViewer.Geometry.Point.

          0
          
        • Optionalright?: number

          The right distance of the inset.

          0
          
        • Optionaltop?: number

          The top distance of the inset. This is equivalent to y of a NutrientViewer.Geometry.Point.

          0
          

      Returns NutrientViewer.Geometry.Inset

    Properties

    bottom: number = ...

    The bottom distance of the inset.

    0
    
    left: number = ...

    The left distance of the inset. This is equivalent to x of a NutrientViewer.Geometry.Point.

    0
    
    right: number = ...

    The right distance of the inset.

    0
    
    top: number = ...

    The top distance of the inset. This is equivalent to y of a NutrientViewer.Geometry.Point.

    0
    

    Methods

    • Returns this

      Map#asImmutable

    • Returns this

      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

      • K extends "left" | "right" | "top" | "bottom"

      Parameters

      • key: K

      Returns this

      remove

    • Parameters

      Returns this

      removeIn

    • Parameters

      • other: unknown

      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

      • K extends "left" | "right" | "top" | "bottom"

      Parameters

      • key: K

      Returns { bottom: number; left: number; right: number; top: number }[K]

    • Parameters

      • keyPath: Iterable<unknown>
      • OptionalnotSetValue: unknown

      Returns unknown

    • Parameters

      • key: unknown

      Returns boolean

    • Parameters

      • ...collections: Partial<{ bottom: number; left: number; right: number; top: number }>[]

      Returns this

    • Parameters

      • ...collections: (
            | Iterable<[string, unknown], any, any>
            | Partial<{ bottom: number; left: number; right: number; top: number }>
        )[]

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • ...collections: (
            | Iterable<[string, unknown], any, any>
            | Partial<{ bottom: number; left: number; right: number; top: number }>
        )[]

      Returns this

    • Parameters

      • merger: (previous?: unknown, next?: unknown, key?: string) => unknown
      • ...collections: (
            | Iterable<[string, unknown], any, any>
            | Partial<{ bottom: number; left: number; right: number; top: number }>
        )[]

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • ...collections: (
            | Iterable<[string, unknown], any, any>
            | Partial<{ bottom: number; left: number; right: number; top: number }>
        )[]

      Returns this

    • Parameters

      • merger: (previous?: unknown, next?: unknown, key?: string) => unknown
      • ...collections: (
            | Iterable<[string, unknown], any, any>
            | Partial<{ bottom: number; left: number; right: number; top: number }>
        )[]

      Returns this

    • Parameters

      Returns this

    • Type Parameters

      • K extends "left" | "right" | "top" | "bottom"

      Parameters

      • key: K
      • value: { bottom: number; left: number; right: number; top: number }[K]

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • value: unknown

      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 { bottom: number; left: number; right: number; top: number }

      • bottom: number

        The bottom distance of the inset.

        0
        
      • left: number

        The left distance of the inset. This is equivalent to x of a NutrientViewer.Geometry.Point.

        0
        
      • right: number

        The right distance of the inset.

        0
        
      • top: number

        The top distance of the inset. This is equivalent to y of a NutrientViewer.Geometry.Point.

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

      Returns { bottom: number; left: number; right: number; top: number }

      • bottom: number

        The bottom distance of the inset.

        0
        
      • left: number

        The left distance of the inset. This is equivalent to x of a NutrientViewer.Geometry.Point.

        0
        
      • right: number

        The right distance of the inset.

        0
        
      • top: number

        The top distance of the inset. This is equivalent to y of a NutrientViewer.Geometry.Point.

        0
        
    • Returns Keyed<string, unknown>

    • Type Parameters

      • K extends "left" | "right" | "top" | "bottom"

      Parameters

      • key: K
      • updater: (
            value: { bottom: number; left: number; right: number; top: number }[K],
        ) => { bottom: number; left: number; right: number; top: number }[K]

      Returns this

    • Parameters

      • keyPath: Iterable<unknown>
      • notSetValue: unknown
      • updater: (value: unknown) => unknown

      Returns this

    • Parameters

      • keyPath: Iterable<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

      Map#withMutations

    • Returns a new inset using the provided vale for all properties.

      Parameters

      • insetValue: number

        An inset value to be applied to all the properties.

      Returns NutrientViewer.Geometry.Inset

      A new Inset.

      const inset = NutrientViewer.Geometry.Inset.fromValue(10);
      // inset ->
      // {
      // left: 10,
      // top: 10,
      // right: 10,
      // bottom: 10,
      // }