You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
857 B
29 lines
857 B
1 year ago
|
import {select} from "d3-selection";
|
||
|
import noevent from "./noevent";
|
||
|
|
||
|
export default function(view) {
|
||
|
var root = view.document.documentElement,
|
||
|
selection = select(view).on("dragstart.drag", noevent, true);
|
||
|
if ("onselectstart" in root) {
|
||
|
selection.on("selectstart.drag", noevent, true);
|
||
|
} else {
|
||
|
root.__noselect = root.style.MozUserSelect;
|
||
|
root.style.MozUserSelect = "none";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export function yesdrag(view, noclick) {
|
||
|
var root = view.document.documentElement,
|
||
|
selection = select(view).on("dragstart.drag", null);
|
||
|
if (noclick) {
|
||
|
selection.on("click.drag", noevent, true);
|
||
|
setTimeout(function() { selection.on("click.drag", null); }, 0);
|
||
|
}
|
||
|
if ("onselectstart" in root) {
|
||
|
selection.on("selectstart.drag", null);
|
||
|
} else {
|
||
|
root.style.MozUserSelect = root.__noselect;
|
||
|
delete root.__noselect;
|
||
|
}
|
||
|
}
|