Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1157615 - 2 fingers taps should never trigger edge gestures. r=alive
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennesegonzac authored and rvandermeulen committed May 28, 2015
1 parent 43170cf commit 4b0a77e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions apps/system/js/edge_swipe_detector.js
Expand Up @@ -273,6 +273,15 @@
if (!this._touchStartEvt) {
return;
}

// Edge gestures are never multi-touch
var touches = e.touches.length + e.changedTouches.length;
if (touches > 1 && !this._forwarding) {
this._touchStartEvt = null;
SheetsTransition.snapInPlace();
return;
}

var touch = e.changedTouches[0];
this._updateProgress(touch);

Expand Down
31 changes: 31 additions & 0 deletions apps/system/test/unit/edge_swipe_detector_test.js
Expand Up @@ -637,6 +637,37 @@ suite('system/EdgeSwipeDetector >', function() {
centerY = Math.floor(window.innerHeight / 2);
});

suite('if it\'s actually a two fingers tap', function() {
var gesture;
setup(function() {
var screenWidth = window.innerWidth;
gesture = (function() {
touchStart(panel, [screenWidth], [100, 100]);
this.sinon.clock.tick();
touchStart(panel, [0], [100, 100]);
this.sinon.clock.tick();
touchEnd(panel, [(screenWidth - 2), 2], [100, 100]);
this.sinon.clock.tick();
touchEnd(panel, [2], [100, 100]);
this.sinon.clock.tick();
}).bind(this);
});

test('it should not move the sheets', function() {
var moveSpy = this.sinon.spy(MockSheetsTransition, 'moveInDirection');
gesture();
assert.isFalse(moveSpy.called);
});

test('it should not move in the stack', function() {
var backSpy = this.sinon.spy(MockStackManager, 'goNext');
var fwSpy = this.sinon.spy(MockStackManager, 'goPrev');
gesture();
assert.isFalse(backSpy.called);
assert.isFalse(fwSpy.called);
});
});

test('it should not move the sheets', function() {
var moveSpy = this.sinon.spy(MockSheetsTransition, 'moveInDirection');
pinch(this.sinon.clock, panel, centerX, centerY);
Expand Down

0 comments on commit 4b0a77e

Please sign in to comment.