Rect prototype for whatever, canvas, selection rects etc
JavaScript
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
component.json
index.js
package.json

Readme.md

rect

Rect prototype (abstract, use it for dom, canvas, etc)

Installation

$ component install component/rect

API

Rect()

Initialize a new Rect with the given position and dimensions, or an object with the same properties.

Rect.moveTo(left:Number, top:Number)

Move to (left, top).

Rect.size(width:Number, height:Number)

Resize to width / height

Rect.to(right:Number, bottom:Number)

Move the second point to (right, bottom).

Rect.intersects(other:Object)

Returns true if two rects overlap.

License

MIT