Add touch support to `d3.svg.mouse`.
This doesn't quite seem like the right place for it, but it seems to work when using "touchstart", "touchmove" and "touchend" handlers without any adverse effects on "true" mouse event handlers. See <http://www.jasondavies.com/apollonian-gasket/> to see an example of combined touch/mouse handlers working with this change.
This commit is contained in:
Родитель
7c518c547c
Коммит
5f2e430f25
|
@ -3176,7 +3176,10 @@ d3.svg.mouse = function(container) {
|
|||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
if (d3_mouse_bug44083) {
|
||||
if (d3.event.touches && d3.event.touches.length > 0) {
|
||||
point.x = d3.event.touches[0].pageX;
|
||||
point.y = d3.event.touches[0].pageY;
|
||||
} else if (d3_mouse_bug44083) {
|
||||
point.x = d3.event.pageX;
|
||||
point.y = d3.event.pageY;
|
||||
} else {
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -10,7 +10,10 @@ d3.svg.mouse = function(container) {
|
|||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
if (d3_mouse_bug44083) {
|
||||
if (d3.event.touches && d3.event.touches.length > 0) {
|
||||
point.x = d3.event.touches[0].pageX;
|
||||
point.y = d3.event.touches[0].pageY;
|
||||
} else if (d3_mouse_bug44083) {
|
||||
point.x = d3.event.pageX;
|
||||
point.y = d3.event.pageY;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче