Merge branch 'fix-multiple-zoom-touchstart' into 3.4.7
This commit is contained in:
Коммит
356d94fb5b
|
@ -1362,7 +1362,7 @@
|
|||
}
|
||||
}
|
||||
function touchstarted() {
|
||||
var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, target = d3.select(d3.event.target).on(touchmove, moved).on(touchend, ended), subject = d3.select(that).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
|
||||
var that = this, dispatch = event.of(that, arguments), locations0 = {}, distance0 = 0, scale0, zoomName = ".zoom-" + d3.event.changedTouches[0].identifier, touchmove = "touchmove" + zoomName, touchend = "touchend" + zoomName, targets = [], subject = d3.select(that).on(mousedown, null).on(touchstart, started), dragRestore = d3_event_dragSuppress();
|
||||
d3_selection_interrupt.call(that);
|
||||
started();
|
||||
zoomstarted(dispatch);
|
||||
|
@ -1375,6 +1375,9 @@
|
|||
return touches;
|
||||
}
|
||||
function started() {
|
||||
var target = d3.event.target;
|
||||
d3.select(target).on(touchmove, moved).on(touchend, ended);
|
||||
targets.push(target);
|
||||
var changed = d3.event.changedTouches;
|
||||
for (var i = 0, n = changed.length; i < n; ++i) {
|
||||
locations0[changed[i].identifier] = null;
|
||||
|
@ -1423,7 +1426,7 @@
|
|||
return void relocate();
|
||||
}
|
||||
}
|
||||
target.on(zoomName, null);
|
||||
d3.selectAll(targets).on(zoomName, null);
|
||||
subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
|
||||
dragRestore();
|
||||
zoomended(dispatch);
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -190,7 +190,7 @@ d3.behavior.zoom = function() {
|
|||
zoomName = ".zoom-" + d3.event.changedTouches[0].identifier,
|
||||
touchmove = "touchmove" + zoomName,
|
||||
touchend = "touchend" + zoomName,
|
||||
target = d3.select(d3.event.target).on(touchmove, moved).on(touchend, ended),
|
||||
targets = [],
|
||||
subject = d3.select(that).on(mousedown, null).on(touchstart, started), // prevent duplicate events
|
||||
dragRestore = d3_event_dragSuppress();
|
||||
|
||||
|
@ -210,7 +210,13 @@ d3.behavior.zoom = function() {
|
|||
|
||||
// Temporarily override touchstart while gesture is active.
|
||||
function started() {
|
||||
// Only track touches started on the target element.
|
||||
|
||||
// Listen for touchmove and touchend on the target of touchstart.
|
||||
var target = d3.event.target;
|
||||
d3.select(target).on(touchmove, moved).on(touchend, ended);
|
||||
targets.push(target);
|
||||
|
||||
// Only track touches started on the same subject element.
|
||||
var changed = d3.event.changedTouches;
|
||||
for (var i = 0, n = changed.length; i < n; ++i) {
|
||||
locations0[changed[i].identifier] = null;
|
||||
|
@ -275,7 +281,7 @@ d3.behavior.zoom = function() {
|
|||
}
|
||||
}
|
||||
// Otherwise, remove touchmove and touchend listeners.
|
||||
target.on(zoomName, null);
|
||||
d3.selectAll(targets).on(zoomName, null);
|
||||
subject.on(mousedown, mousedowned).on(touchstart, touchstarted);
|
||||
dragRestore();
|
||||
zoomended(dispatch);
|
||||
|
|
Загрузка…
Ссылка в новой задаче