Skip to content

Commit b2af9c5

Browse files
authored
Merge pull request #33 from owenliang/gh-pages
perfect version
2 parents d6bd12f + 12c7ae4 commit b2af9c5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pullToRefresh.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ function (container, option) {
205205
// 浏览器对changedTouches的实现存在问题, 因此总是使用全量的touches进行比对
206206
function compareTouchFingers(event) {
207207
var identSet = {};
208-
// 将不存在手指的添加到集合中
208+
209+
// 添加target内新出现的手指
209210
for (var i = 0; i < event.originalEvent.targetTouches.length; ++i) {
210211
var touch = event.originalEvent.targetTouches[i];
211212
identSet[touch.identifier] = true;
@@ -214,10 +215,10 @@ function (container, option) {
214215
++fingerCount;
215216
}
216217
}
217-
// 将已删除的手指集合清理
218+
// 将target内消失的手指移除
218219
for (var identifier in touchFingers) {
219-
// 浏览器集合中已不存在,删除
220-
if (identSet[identifier] === undefined) {
220+
// 与本次touchevent属于同一个target,但是touchevent中已消失的手指,需要移除
221+
if (identSet[identifier] === undefined && touchFingers[identifier].target === event.originalEvent.target) {
221222
delete(touchFingers[identifier]);
222223
--fingerCount;
223224
}

0 commit comments

Comments
 (0)