API Docs

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) -> None

Create a new HSRect object
constructor(x, y, w, h) -> None
Name Type Description
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
None