diff --git a/apps/system/js/edge_swipe_detector.js b/apps/system/js/edge_swipe_detector.js index 59d21b5ee5d2..60f61e83dff1 100644 --- a/apps/system/js/edge_swipe_detector.js +++ b/apps/system/js/edge_swipe_detector.js @@ -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); diff --git a/apps/system/test/unit/edge_swipe_detector_test.js b/apps/system/test/unit/edge_swipe_detector_test.js index 660558f9e9d3..be3407648c5a 100644 --- a/apps/system/test/unit/edge_swipe_detector_test.js +++ b/apps/system/test/unit/edge_swipe_detector_test.js @@ -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);