Remove usage of d3_array for efficiency.
This avoids unnecessarily creating a new array for every touch event.
This commit is contained in:
Родитель
a5f140709c
Коммит
1bb3e9b025
|
@ -3183,7 +3183,11 @@ function d3_svg_mousePoints(container, events) {
|
|||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
return events.map(function(e) {
|
||||
var i = -1,
|
||||
n = events.length,
|
||||
points = [];
|
||||
while (++i < n) {
|
||||
var e = events[i];
|
||||
if (d3_mouse_bug44083) {
|
||||
point.x = e.pageX;
|
||||
point.y = e.pageY;
|
||||
|
@ -3192,13 +3196,14 @@ function d3_svg_mousePoints(container, events) {
|
|||
point.y = e.clientY;
|
||||
}
|
||||
point = point.matrixTransform(container.getScreenCTM().inverse());
|
||||
return [point.x, point.y];
|
||||
});
|
||||
points.push([point.x, point.y]);
|
||||
}
|
||||
return points;
|
||||
};
|
||||
d3.svg.touches = function(container) {
|
||||
var touches = d3.event.touches;
|
||||
return touches && touches.length
|
||||
? d3_svg_mousePoints(container, d3_array(touches)) : [];
|
||||
? d3_svg_mousePoints(container, touches) : [];
|
||||
};
|
||||
d3.svg.symbol = function() {
|
||||
var type = d3_svg_symbolType,
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -17,7 +17,11 @@ function d3_svg_mousePoints(container, events) {
|
|||
d3_mouse_bug44083 = !(ctm.f || ctm.e);
|
||||
svg.remove();
|
||||
}
|
||||
return events.map(function(e) {
|
||||
var i = -1,
|
||||
n = events.length,
|
||||
points = [];
|
||||
while (++i < n) {
|
||||
var e = events[i];
|
||||
if (d3_mouse_bug44083) {
|
||||
point.x = e.pageX;
|
||||
point.y = e.pageY;
|
||||
|
@ -26,6 +30,7 @@ function d3_svg_mousePoints(container, events) {
|
|||
point.y = e.clientY;
|
||||
}
|
||||
point = point.matrixTransform(container.getScreenCTM().inverse());
|
||||
return [point.x, point.y];
|
||||
});
|
||||
points.push([point.x, point.y]);
|
||||
}
|
||||
return points;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
d3.svg.touches = function(container) {
|
||||
var touches = d3.event.touches;
|
||||
return touches && touches.length
|
||||
? d3_svg_mousePoints(container, d3_array(touches)) : [];
|
||||
? d3_svg_mousePoints(container, touches) : [];
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче