documentationfor yFiles for HTML 2.6

Represents insets (or outsets) for a rectangular area in two-dimensional Cartesian coordinates.

Inheritance Hierarchy
Insets

Remarks

This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.

It is possible to specify a single number, an Object or a plain Object to define Insets:

5 // horizontal and vertical
[5] // also horizontal and vertical
[5, 10] // vertical, horizontal
[5, 10, 15] // top, horizontal, bottom
[5, 10, 15, 20] // top, right, bottom, left
// for objects, all properties are optional and 0 implicitly when omitted,
// but at least one needs to be specified:
{ top: 5, right: 10, bottom: 15, left: 20}
{ horizontal: 10, vertical: 5}
{ horizontal: 5, right: 10} // more specific value wins, so right becomes 10

Examples

The following example shows a few ways to use Insets:
// Create new insets
const insets = new Insets(10, 10, 5, 2)
// Create other insets that are uniform on every side
const insets2 = new Insets(12)

console.log(`Top:    ${insets.top}`)
console.log(`Bottom: ${insets.bottom}`)
console.log(`Left:   ${insets.left}`)
console.log(`Right:  ${insets.right}`)

console.log(`Total vertical:   ${insets.verticalInsets}`)
console.log(`Total horizontal: ${insets.horizontalInsets}`)

// Enlarge the first insets
const larger = insets.getEnlarged(new Insets(2))
console.log(larger) // left: 12, top: 12, right: 7, bottom: 4

// Reduce them again
const smaller = larger.getReduced(new Insets(1, 5, 2, 3))
console.log(smaller) // left: 11, top: 7, right: 5, bottom: 1

// Scale by a uniform factor
const scaled = Insets.multiply(insets, 1.5)
console.log(scaled) // left: 15, top: 15, right: 7.5, bottom: 3

Type Details

yfiles module
view-component
yfiles-umd modules
All view modules
Legacy UMD name
yfiles.geometry.Insets

See Also

Sample Graphs

Constructors

Properties

Methods

Constants

Static Methods