Skip to content

Commit

Permalink
Don't restrict if restriction element has no rect
Browse files Browse the repository at this point in the history
Closes #144
  • Loading branch information
taye committed Dec 30, 2014
1 parent 8315fba commit c3ec7f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -2869,10 +2869,14 @@

rect = restriction;

if (!restriction) {
restrictedX = page.x;
restrictedY = page.y;
}
// object is assumed to have
// x, y, width, height or
// left, top, right, bottom
if ('x' in restriction && 'y' in restriction) {
else if ('x' in restriction && 'y' in restriction) {
restrictedX = Math.max(Math.min(rect.x + rect.width - this.restrictOffset.right , page.x), rect.x + this.restrictOffset.left);
restrictedY = Math.max(Math.min(rect.y + rect.height - this.restrictOffset.bottom, page.y), rect.y + this.restrictOffset.top );
}
Expand Down

0 comments on commit c3ec7f4

Please sign in to comment.