Skip to content

Commit

Permalink
Update moveToObject.js
Browse files Browse the repository at this point in the history
Guess I stumbled upon a bug. This is my first github bugfix attempt :)

So I'm not entirely sure this works, because I don't use mobile testing yet, but this seems more like what the description is saying:
Default: move to center of the element
When offset is set: move to left top of the element + offset

Can someone verify + test this?

Thanks!
Daan
  • Loading branch information
DV3D committed Jan 21, 2016
1 parent 596b877 commit b7fcf06
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/commands/moveToObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ module.exports = function moveToObject(selector, xoffset, yoffset) {
});
});
}).then(function(res) {
var x = res.location.value.x,
y = res.location.value.y;
var x = res.location.value.x + (res.size.value.width / 2),
y = res.location.value.y + (res.size.value.height / 2);

if(hasOffsetParams) {
x = res.location.value.x - (res.size.value.width / 2) + xoffset;
y = res.location.value.y - (res.size.value.height / 2) + yoffset;
x = res.location.value.x + xoffset;
y = res.location.value.y + yoffset;
}

return this.touchMove(x, y);
Expand Down

0 comments on commit b7fcf06

Please sign in to comment.