This is a JavaScript object used to represent a rectangle, as used in various places throughout Hammerspoon's API, particularly where dealing with portions of a display. Behind the scenes it is a wrapper for the CGRect type in Swift/ObjectiveC.

Properties

x

number

An x-axis coordinate for the top-left point of the rectangle

y

number

A y-axis coordinate for the top-left point of the rectangle

w

number

The width of the rectangle

h

number

The height of the rectangle

origin

HSPoint

The "origin" of the rectangle, ie the coordinates of its top left corner, as an HSPoint object

size

HSSize

The size of the rectangle, ie its width and height, as an HSSize object

Methods

constructor(x, y, w, h)

Create a new HSRect object

Parameters

  • x number

    The x-axis coordinate of the top-left corner

  • y number

    The y-axis coordinate of the top-left corner

  • w number

    The width of the rectangle

  • h number

    The height of the rectangle

Returns

Nothing