Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The drag behavior no longer crashes when the element being dragged is removed from the DOM. In addition, the new d3.touch method extracts a single identified touch from the current touch event, making it more efficient during multitouch. The drag behavior now assigns touchmove and touchend listeners on the target element of the touchstart event, rather than the window.
- Loading branch information
Showing
5 changed files
with
100 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import "dispatch"; | ||
import "event"; | ||
import "mouse"; | ||
import "touch"; | ||
import "touches"; | ||
import "timer"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "event"; | ||
import "mouse"; | ||
|
||
d3.touch = function(container, touches, identifier) { | ||
if (arguments.length < 3) identifier = touches, touches = d3_eventSource().touches; | ||
if (touches) for (var i = 0, n = touches.length, touch; i < n; ++i) { | ||
if ((touch = touches[i]).identifier === identifier) { | ||
return d3_mousePoint(container, touch); | ||
} | ||
} | ||
}; |