contain-rect

0.0.2 • Public • Published

contain-rect

Install

Run npm install contain-rect in your project folder

usage

The first parameter is the container, the second is the the subject rect that needs to be contained. As third (optional) paramter you can set a offset which function as an allround padding withing the container.

Example

const containRect = require('contain-rect')

const container = { x: 50, y: 40, width: 100, height: 100 } 
const subject = { x: -5, y: -40, width: 120, height: 120 }

containRect(container, subject, 1) //=> { x: 31, y: 21 }

Readme

Keywords

none

Package Sidebar

Install

npm i contain-rect

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

1.61 kB

Total Files

3

Last publish

Collaborators

  • frankvanvuuren