Merge pull request #3733 from imurchie/isaac-android-release

Use last coordinates for touch release
This commit is contained in:
Jonathan Lipps
2014-10-04 11:26:11 -07:00

View File

@@ -913,6 +913,21 @@ androidController.performTouch = function (gestures, cb) {
// the `longPress` and `tap` methods release on their own
gestures.pop();
}
if (actions[actions.length - 1] === 'release') {
// without coordinates, `release` uses the center of the screen, which,
// generally speaking, is not what we want
// therefore: loop backwards and use the last command with an element and/or
// offset coordinates
for (var i = actions.length - 2; i >= 0; i--) {
var opts = gestures[i].options || {};
if (opts.element || (opts.x && opts.y)) {
gestures[gestures.length - 1].options = _.clone(opts);
break;
}
}
}
var cycleThroughGestures = function (err, res) {
if (err) return cb(err);