Skip to content

Commit

Permalink
Fix filtering of multitouch gestures. #176
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed Aug 10, 2019
1 parent 7a4a0cc commit 523ccff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,17 @@ export default function() {

function touchstarted() {
if (!filter.apply(this, arguments)) return;
var touches = event.changedTouches,
var touches = event.touches,
n = touches.length,
g = gesture(this, arguments, event.touches.length === n),
g = gesture(this, arguments, event.changedTouches.length === n),
started, i, t, p;

nopropagation();
for (i = 0; i < n; ++i) {
t = touches[i], p = touch(this, touches, t.identifier);
p = [p, this.__zoom.invert(p), t.identifier];
if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
else if (!g.touch1) g.touch1 = p, g.taps = 0;
else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;
}

if (touchstarting) touchstarting = clearTimeout(touchstarting);
Expand Down

0 comments on commit 523ccff

Please sign in to comment.