Skip to content

Commit

Permalink
Subtract origin from snap relative startCoords
Browse files Browse the repository at this point in the history
  • Loading branch information
taye committed Dec 16, 2014
1 parent 640d0ca commit 3d31d1c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions interact.js
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,8 @@
var rect = interactable.getRect(element),
snap = interactable.options[this.prepared.name].snap,
restrict = interactable.options[this.prepared.name].restrict,
width, height;
width, height,
origin = getOriginXY(interactable, element);

if (rect) {
this.startOffset.left = this.startCoords.page.x - rect.left;
Expand All @@ -1602,7 +1603,10 @@
var relative = snap.relativePoints[i];

this.snapOffsets.push(relative === 'startCoords'
? this.startCoords.page
? {
x: this.startCoords.page.x - origin.x,
y: this.startCoords.page.y - origin.y
}
: {
x: this.startOffset.left - (width * relative.x),
y: this.startOffset.top - (height * relative.y)
Expand Down

0 comments on commit 3d31d1c

Please sign in to comment.