cubiq / iscroll

Smooth scrolling for the web
http://iscrolljs.com
MIT License
12.87k stars 3.8k forks source link

Prevent scroll when second or more touch is detected. #17

Open thomasyip opened 13 years ago

thomasyip commented 13 years ago

I am using iScroll with gestures.js. I am assignment 2-finger swipe to something else.

Below is a tested patch.

====== iscroll.js line: 298 ==========
        that.pointX = point.pageX;
        that.pointY = point.pageY;

        that.startTime = e.timeStamp;

        if (that.options.onScrollStart) that.options.onScrollStart.call(that);

+       if (hasTouch && e.touches.length < 1) {
+           that.scrolling = false;
+           that.resetPosition();
+       }
+
        // Registering/unregistering of events is done to preserve resources on Android
        setTimeout(function () {
damianmr commented 13 years ago

I would suggest using "targetTouches" instead of touches.

davidpfahler commented 10 years ago

Multiple touches do not lead to aborted scrolling in iOS 7 in UITableView. But, you should be able to set and option that aborts scrolling when multiple touches occur and not in zooming mode. Feature for future release.