-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrag.js
More file actions
24 lines (22 loc) · 911 Bytes
/
Copy pathdrag.js
File metadata and controls
24 lines (22 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import "../core/document";
import "../core/vendor";
import "../selection/on";
var d3_event_dragSelect = d3_vendorSymbol(d3_documentElement.style, "userSelect");
function d3_event_dragSuppress(type) {
var selectstart = "selectstart." + type,
dragstart = "dragstart." + type,
click = "click." + type,
w = d3.select(d3_window).on(selectstart, d3_eventPreventDefault).on(dragstart, d3_eventPreventDefault),
style = d3_documentElement.style,
select = style[d3_event_dragSelect];
style[d3_event_dragSelect] = "none";
return function(suppressClick) {
w.on(selectstart, null).on(dragstart, null);
style[d3_event_dragSelect] = select;
if (suppressClick) { // suppress the next click, but only if it’s immediate
function off() { w.on(click, null); }
w.on(click, function() { d3_eventPreventDefault(); off(); }, true);
setTimeout(off, 0);
}
};
}