Skip to content

Instantly share code, notes, and snippets.

@fupslot
Created January 10, 2016 09:30
Show Gist options
  • Save fupslot/213dbb4bc8d44f7b2d76 to your computer and use it in GitHub Desktop.
Save fupslot/213dbb4bc8d44f7b2d76 to your computer and use it in GitHub Desktop.
function getInset(rectA, rectB) {
return {
top: (rectB.top - rectB.top),
right: (rectA.left + rectA.width) - (rectB.left + rectB.width),
bottom: (rectA.top + rectA.height) - (rectB.top + rectB.height),
left: rectB.left - rectB.left
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment