From b7fcf06f9f3edc1a89d8cac8489cfd98e05f5375 Mon Sep 17 00:00:00 2001 From: DV3D Date: Thu, 21 Jan 2016 20:21:32 +0100 Subject: [PATCH] Update moveToObject.js 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 --- lib/commands/moveToObject.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/commands/moveToObject.js b/lib/commands/moveToObject.js index dd5b0e262ce..1ea74668a1d 100644 --- a/lib/commands/moveToObject.js +++ b/lib/commands/moveToObject.js @@ -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);