Class Spot

A Spot represents a relative point from(0, 0) to(1, 1) within the bounds of a rectangular area plus an absolute offset.

Index

Constructor methods

Properties

Methods

Constructor methods

constructor(): Spot

The default constructor produces the Spot(0, 0, 0, 0), at the top-left corner.

Returns

Spot

constructor(x: number, y: number): Spot

The two-argument constructor produces the Spot(x, y), where X and Y are fractional distances, between zero and one.

Parameters

  • x: number

    must be between zero and one, inclusive.

  • y: number

    must be between zero and one, inclusive.

Returns

Spot

constructor(x: number, y: number, offx: number, offy: number): Spot

The four-argument constructor produces the Spot(x, y, offx, offy), where X and Y are fractional distances, between zero and one, and OFFX and OFFY are additional absolute offsets.

Parameters

  • x: number

    must be between zero and one, inclusive.

  • y: number

    must be between zero and one, inclusive.

  • offx: number

    an offset along the X coordinates, may be negative.

  • offy: number

    an offset along the Y coordinates, may be negative.

Returns

Spot

Properties

public static AllSides: Spot

The set of points on all sides of the bounding rectangle.

public static Bottom: Spot

A synonym for Spot#BottomCenter.

public static BottomCenter: Spot

The specific point at the middle of the bottom side of bounding rectangle.

public static BottomLeft: Spot

The specific point at the bottom-left corner of the bounding rectangle.

public static BottomLeftSides: Spot

The set of points at the left or bottom sides of the bounding rectangle.

public static BottomRight: Spot

The specific point at the bottom-right corner of the bounding rectangle.

public static BottomRightSides: Spot

The set of points at the right or bottom sides of the bounding rectangle.

public static BottomSide: Spot

The set of points at the bottom side of the bounding rectangle.

public static Center: Spot

The specific point at the very center of the bounding rectangle.

public static Default: Spot

Use this value to indicate that the real spot value is inherited from elsewhere.

public static Left: Spot

A synonym for Spot#LeftCenter.

public static LeftCenter: Spot

The specific point at the middle of the left side of bounding rectangle.

public static LeftRightSides: Spot

The set of points at the left or right sides of the bounding rectangle.

public static LeftSide: Spot

The set of points at the left side of the bounding rectangle.

public static MiddleBottom: Spot

A synonym for Spot#BottomCenter.

public static MiddleLeft: Spot

A synonym for Spot#LeftCenter.

public static MiddleRight: Spot

A synonym for Spot#RightCenter.

public static MiddleTop: Spot

A synonym for Spot#TopCenter.

public static None: Spot

Use this Spot value to indicate no particular spot -- code looking for a particular point on an element will need to do their own calculations to determine the desired point depending on the circumstances.

public static NotBottomSide: Spot

The set of points on all sides of bounding rectangle except bottom side.

public static NotLeftSide: Spot

The set of points on all sides of the bounding rectangle except left side.

public static NotRightSide: Spot

The set of points on all sides of the bounding rectangle except right side.

public static NotTopSide: Spot

The set of points on all sides of the bounding rectangle except top side.

public static Right: Spot

A synonym for Spot#RightCenter.

public static RightCenter: Spot

The specific point at the middle of the right side of bounding rectangle.

public static RightSide: Spot

The set of points at the right side of the bounding rectangle.

public static Top: Spot

A synonym for Spot#TopCenter.

public static TopBottomSides: Spot

The set of points at the top or bottom sides of the bounding rectangle.

public static TopCenter: Spot

The specific point at the center of the top side of the bounding rectangle.

public static TopLeft: Spot

The specific point at the top-left corner of the bounding rectangle.

public static TopLeftSides: Spot

The set of points at the top or left sides of the bounding rectangle.

public static TopRight: Spot

The specific point at the top-right corner of the bounding rectangle.

public static TopRightSides: Spot

The set of points at the top or right sides of the bounding rectangle.

public static TopSide: Spot

The set of points at the top side of the bounding rectangle.

public offsetX: number

Gets or sets the offsetX value of the Spot.

public offsetY: number

Gets or sets the offsetY value of the Spot.

public x: number

Gets or sets the x value of the Spot, a fractional value between zero and one.

public y: number

Gets or sets the y value of the Spot, a fractional value between zero and one.

Methods

public copy(): Spot

Create a copy of this Spot, with the same values.

Returns

Spot

public equals(spot: Spot): boolean

Two spots are equal if all four property values are the same.

Parameters

  • spot: Spot

    The Spot to compare to the current Spot.

Returns

boolean

public includesSide(side: Spot): boolean

This predicate is true if this Spot is a side that includes the side(s) given by the argument Spot.

Parameters

Returns

boolean

public isDefault(): boolean

True if this is a special spot referring to the default spot.

Returns

boolean

public isNoSpot(): boolean

True if this is an unspecific special spot, such as Spot#None or one of the sides.

Returns

boolean

public isSide(): boolean

True if this is a special spot referring to one (or more) of the sides.

Returns

boolean

public isSpot(): boolean

True if this is a specific spot, not a side nor Spot#None.

Returns

boolean

public opposite(): Spot

Return a new spot that is opposite this spot.

Returns

Spot

public static parse(str: string): Spot

This static method can be used to read in a Spot from a string that was produced by Spot.stringify.

Parameters

  • str: string

Returns

Spot

public set(s: Spot): Spot

Modify this Spot so that its X, Y, OffsetX, and OffsetY values are the same as the given Spot.

Parameters

  • s: Spot

    the given Spot.

Returns

Spot

public setTo(x: number, y: number, offx: number, offy: number): Spot

Modify this Spot with new X, Y, OffsetX, and OffsetY values.

Parameters

  • x: number
  • y: number
  • offx: number
  • offy: number

Returns

Spot

public static stringify(val: Spot): string

This static method can be used to write out a Spot as a string that can be read by Spot.parse.

Parameters

Returns

string