source: node_modules/d3-drag/src/nodrag.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 920 bytes
Line 
1import {select} from "d3-selection";
2import noevent, {nonpassivecapture} from "./noevent.js";
3
4export default function(view) {
5 var root = view.document.documentElement,
6 selection = select(view).on("dragstart.drag", noevent, nonpassivecapture);
7 if ("onselectstart" in root) {
8 selection.on("selectstart.drag", noevent, nonpassivecapture);
9 } else {
10 root.__noselect = root.style.MozUserSelect;
11 root.style.MozUserSelect = "none";
12 }
13}
14
15export function yesdrag(view, noclick) {
16 var root = view.document.documentElement,
17 selection = select(view).on("dragstart.drag", null);
18 if (noclick) {
19 selection.on("click.drag", noevent, nonpassivecapture);
20 setTimeout(function() { selection.on("click.drag", null); }, 0);
21 }
22 if ("onselectstart" in root) {
23 selection.on("selectstart.drag", null);
24 } else {
25 root.style.MozUserSelect = root.__noselect;
26 delete root.__noselect;
27 }
28}
Note: See TracBrowser for help on using the repository browser.