Optimise.
This block is only necessary if there are remaining touches, because otherwise the gesture has ended and we remove this closure along with locations0. Thanks, @mbostock!
This commit is contained in:
Родитель
abc9dbb07f
Коммит
36b8a0b1ff
|
@ -1407,11 +1407,11 @@ d3 = function() {
|
|||
zoomed(event_);
|
||||
}
|
||||
function ended() {
|
||||
var touches = d3.event.changedTouches;
|
||||
for (var i = 0, n = touches.length; i < n; ++i) {
|
||||
delete locations0[touches[i].identifier];
|
||||
}
|
||||
if (d3.event.touches.length) {
|
||||
var touches = d3.event.changedTouches;
|
||||
for (var i = 0, n = touches.length; i < n; ++i) {
|
||||
delete locations0[touches[i].identifier];
|
||||
}
|
||||
relocate();
|
||||
} else {
|
||||
w.on(touchmove, null).on(touchend, null);
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -261,11 +261,11 @@ d3.behavior.zoom = function() {
|
|||
}
|
||||
|
||||
function ended() {
|
||||
var touches = d3.event.changedTouches;
|
||||
for (var i = 0, n = touches.length; i < n; ++i) {
|
||||
delete locations0[touches[i].identifier];
|
||||
}
|
||||
if (d3.event.touches.length) {
|
||||
var touches = d3.event.changedTouches;
|
||||
for (var i = 0, n = touches.length; i < n; ++i) {
|
||||
delete locations0[touches[i].identifier];
|
||||
}
|
||||
relocate(); // locations may have detached due to rotation
|
||||
} else {
|
||||
w.on(touchmove, null).on(touchend, null);
|
||||
|
|
Загрузка…
Ссылка в новой задаче