Initial commit
This commit is contained in:
16
node_modules/d3-drag/.eslintrc.json
generated
vendored
Normal file
16
node_modules/d3-drag/.eslintrc.json
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 8
|
||||
},
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"rules": {
|
||||
"no-cond-assign": 0,
|
||||
"no-fallthrough": 0
|
||||
}
|
||||
}
|
||||
27
node_modules/d3-drag/LICENSE
generated
vendored
Normal file
27
node_modules/d3-drag/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
Copyright 2010-2016 Mike Bostock
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the author nor the names of contributors may be used to
|
||||
endorse or promote products derived from this software without specific prior
|
||||
written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
234
node_modules/d3-drag/dist/d3-drag.js
generated
vendored
Normal file
234
node_modules/d3-drag/dist/d3-drag.js
generated
vendored
Normal file
@@ -0,0 +1,234 @@
|
||||
// https://d3js.org/d3-drag/ v1.2.3 Copyright 2018 Mike Bostock
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-selection'), require('d3-dispatch')) :
|
||||
typeof define === 'function' && define.amd ? define(['exports', 'd3-selection', 'd3-dispatch'], factory) :
|
||||
(factory((global.d3 = global.d3 || {}),global.d3,global.d3));
|
||||
}(this, (function (exports,d3Selection,d3Dispatch) { 'use strict';
|
||||
|
||||
function nopropagation() {
|
||||
d3Selection.event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
function noevent() {
|
||||
d3Selection.event.preventDefault();
|
||||
d3Selection.event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
function nodrag(view) {
|
||||
var root = view.document.documentElement,
|
||||
selection = d3Selection.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";
|
||||
}
|
||||
}
|
||||
|
||||
function yesdrag(view, noclick) {
|
||||
var root = view.document.documentElement,
|
||||
selection = d3Selection.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;
|
||||
}
|
||||
}
|
||||
|
||||
function constant(x) {
|
||||
return function() {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
|
||||
function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
|
||||
this.target = target;
|
||||
this.type = type;
|
||||
this.subject = subject;
|
||||
this.identifier = id;
|
||||
this.active = active;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this._ = dispatch;
|
||||
}
|
||||
|
||||
DragEvent.prototype.on = function() {
|
||||
var value = this._.on.apply(this._, arguments);
|
||||
return value === this._ ? this : value;
|
||||
};
|
||||
|
||||
// Ignore right-click, since that should open the context menu.
|
||||
function defaultFilter() {
|
||||
return !d3Selection.event.button;
|
||||
}
|
||||
|
||||
function defaultContainer() {
|
||||
return this.parentNode;
|
||||
}
|
||||
|
||||
function defaultSubject(d) {
|
||||
return d == null ? {x: d3Selection.event.x, y: d3Selection.event.y} : d;
|
||||
}
|
||||
|
||||
function defaultTouchable() {
|
||||
return "ontouchstart" in this;
|
||||
}
|
||||
|
||||
function drag() {
|
||||
var filter = defaultFilter,
|
||||
container = defaultContainer,
|
||||
subject = defaultSubject,
|
||||
touchable = defaultTouchable,
|
||||
gestures = {},
|
||||
listeners = d3Dispatch.dispatch("start", "drag", "end"),
|
||||
active = 0,
|
||||
mousedownx,
|
||||
mousedowny,
|
||||
mousemoving,
|
||||
touchending,
|
||||
clickDistance2 = 0;
|
||||
|
||||
function drag(selection) {
|
||||
selection
|
||||
.on("mousedown.drag", mousedowned)
|
||||
.filter(touchable)
|
||||
.on("touchstart.drag", touchstarted)
|
||||
.on("touchmove.drag", touchmoved)
|
||||
.on("touchend.drag touchcancel.drag", touchended)
|
||||
.style("touch-action", "none")
|
||||
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
||||
}
|
||||
|
||||
function mousedowned() {
|
||||
if (touchending || !filter.apply(this, arguments)) return;
|
||||
var gesture = beforestart("mouse", container.apply(this, arguments), d3Selection.mouse, this, arguments);
|
||||
if (!gesture) return;
|
||||
d3Selection.select(d3Selection.event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
|
||||
nodrag(d3Selection.event.view);
|
||||
nopropagation();
|
||||
mousemoving = false;
|
||||
mousedownx = d3Selection.event.clientX;
|
||||
mousedowny = d3Selection.event.clientY;
|
||||
gesture("start");
|
||||
}
|
||||
|
||||
function mousemoved() {
|
||||
noevent();
|
||||
if (!mousemoving) {
|
||||
var dx = d3Selection.event.clientX - mousedownx, dy = d3Selection.event.clientY - mousedowny;
|
||||
mousemoving = dx * dx + dy * dy > clickDistance2;
|
||||
}
|
||||
gestures.mouse("drag");
|
||||
}
|
||||
|
||||
function mouseupped() {
|
||||
d3Selection.select(d3Selection.event.view).on("mousemove.drag mouseup.drag", null);
|
||||
yesdrag(d3Selection.event.view, mousemoving);
|
||||
noevent();
|
||||
gestures.mouse("end");
|
||||
}
|
||||
|
||||
function touchstarted() {
|
||||
if (!filter.apply(this, arguments)) return;
|
||||
var touches = d3Selection.event.changedTouches,
|
||||
c = container.apply(this, arguments),
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = beforestart(touches[i].identifier, c, d3Selection.touch, this, arguments)) {
|
||||
nopropagation();
|
||||
gesture("start");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function touchmoved() {
|
||||
var touches = d3Selection.event.changedTouches,
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = gestures[touches[i].identifier]) {
|
||||
noevent();
|
||||
gesture("drag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function touchended() {
|
||||
var touches = d3Selection.event.changedTouches,
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
if (touchending) clearTimeout(touchending);
|
||||
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = gestures[touches[i].identifier]) {
|
||||
nopropagation();
|
||||
gesture("end");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function beforestart(id, container, point, that, args) {
|
||||
var p = point(container, id), s, dx, dy,
|
||||
sublisteners = listeners.copy();
|
||||
|
||||
if (!d3Selection.customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
|
||||
if ((d3Selection.event.subject = s = subject.apply(that, args)) == null) return false;
|
||||
dx = s.x - p[0] || 0;
|
||||
dy = s.y - p[1] || 0;
|
||||
return true;
|
||||
})) return;
|
||||
|
||||
return function gesture(type) {
|
||||
var p0 = p, n;
|
||||
switch (type) {
|
||||
case "start": gestures[id] = gesture, n = active++; break;
|
||||
case "end": delete gestures[id], --active; // nobreak
|
||||
case "drag": p = point(container, id), n = active; break;
|
||||
}
|
||||
d3Selection.customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
|
||||
};
|
||||
}
|
||||
|
||||
drag.filter = function(_) {
|
||||
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), drag) : filter;
|
||||
};
|
||||
|
||||
drag.container = function(_) {
|
||||
return arguments.length ? (container = typeof _ === "function" ? _ : constant(_), drag) : container;
|
||||
};
|
||||
|
||||
drag.subject = function(_) {
|
||||
return arguments.length ? (subject = typeof _ === "function" ? _ : constant(_), drag) : subject;
|
||||
};
|
||||
|
||||
drag.touchable = function(_) {
|
||||
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), drag) : touchable;
|
||||
};
|
||||
|
||||
drag.on = function() {
|
||||
var value = listeners.on.apply(listeners, arguments);
|
||||
return value === listeners ? drag : value;
|
||||
};
|
||||
|
||||
drag.clickDistance = function(_) {
|
||||
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
|
||||
};
|
||||
|
||||
return drag;
|
||||
}
|
||||
|
||||
exports.drag = drag;
|
||||
exports.dragDisable = nodrag;
|
||||
exports.dragEnable = yesdrag;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
2
node_modules/d3-drag/dist/d3-drag.min.js
generated
vendored
Normal file
2
node_modules/d3-drag/dist/d3-drag.min.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// https://d3js.org/d3-drag/ v1.2.3 Copyright 2018 Mike Bostock
|
||||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-selection"),require("d3-dispatch")):"function"==typeof define&&define.amd?define(["exports","d3-selection","d3-dispatch"],e):e(t.d3=t.d3||{},t.d3,t.d3)}(this,function(t,e,n){"use strict";function o(){e.event.stopImmediatePropagation()}function i(){e.event.preventDefault(),e.event.stopImmediatePropagation()}function r(t){var n=t.document.documentElement,o=e.select(t).on("dragstart.drag",i,!0);"onselectstart"in n?o.on("selectstart.drag",i,!0):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function c(t,n){var o=t.document.documentElement,r=e.select(t).on("dragstart.drag",null);n&&(r.on("click.drag",i,!0),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in o?r.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}function u(t){return function(){return t}}function s(t,e,n,o,i,r,c,u,s,a){this.target=t,this.type=e,this.subject=n,this.identifier=o,this.active=i,this.x=r,this.y=c,this.dx=u,this.dy=s,this._=a}function a(){return!e.event.button}function l(){return this.parentNode}function d(t){return null==t?{x:e.event.x,y:e.event.y}:t}function f(){return"ontouchstart"in this}s.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t},t.drag=function(){var t,h,p,v,g=a,m=l,y=d,b=f,_={},w=n.dispatch("start","drag","end"),x=0,T=0;function j(t){t.on("mousedown.drag",k).filter(b).on("touchstart.drag",q).on("touchmove.drag",z).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function k(){if(!v&&g.apply(this,arguments)){var n=P("mouse",m.apply(this,arguments),e.mouse,this,arguments);n&&(e.select(e.event.view).on("mousemove.drag",E,!0).on("mouseup.drag",M,!0),r(e.event.view),o(),p=!1,t=e.event.clientX,h=e.event.clientY,n("start"))}}function E(){if(i(),!p){var n=e.event.clientX-t,o=e.event.clientY-h;p=n*n+o*o>T}_.mouse("drag")}function M(){e.select(e.event.view).on("mousemove.drag mouseup.drag",null),c(e.event.view,p),i(),_.mouse("end")}function q(){if(g.apply(this,arguments)){var t,n,i=e.event.changedTouches,r=m.apply(this,arguments),c=i.length;for(t=0;t<c;++t)(n=P(i[t].identifier,r,e.touch,this,arguments))&&(o(),n("start"))}}function z(){var t,n,o=e.event.changedTouches,r=o.length;for(t=0;t<r;++t)(n=_[o[t].identifier])&&(i(),n("drag"))}function D(){var t,n,i=e.event.changedTouches,r=i.length;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),t=0;t<r;++t)(n=_[i[t].identifier])&&(o(),n("end"))}function P(t,n,o,i,r){var c,u,a,l=o(n,t),d=w.copy();if(e.customEvent(new s(j,"beforestart",c,t,x,l[0],l[1],0,0,d),function(){return null!=(e.event.subject=c=y.apply(i,r))&&(u=c.x-l[0]||0,a=c.y-l[1]||0,!0)}))return function f(h){var p,v=l;switch(h){case"start":_[t]=f,p=x++;break;case"end":delete _[t],--x;case"drag":l=o(n,t),p=x}e.customEvent(new s(j,h,c,t,p,l[0]+u,l[1]+a,l[0]-v[0],l[1]-v[1],d),d.apply,d,[h,i,r])}}return j.filter=function(t){return arguments.length?(g="function"==typeof t?t:u(!!t),j):g},j.container=function(t){return arguments.length?(m="function"==typeof t?t:u(t),j):m},j.subject=function(t){return arguments.length?(y="function"==typeof t?t:u(t),j):y},j.touchable=function(t){return arguments.length?(b="function"==typeof t?t:u(!!t),j):b},j.on=function(){var t=w.on.apply(w,arguments);return t===w?j:t},j.clickDistance=function(t){return arguments.length?(T=(t=+t)*t,j):Math.sqrt(T)},j},t.dragDisable=r,t.dragEnable=c,Object.defineProperty(t,"__esModule",{value:!0})});
|
||||
29
node_modules/d3-drag/package.json
generated
vendored
Normal file
29
node_modules/d3-drag/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "d3-drag",
|
||||
"version": "1.2.3",
|
||||
"description": "Drag and drop SVG, HTML or Canvas using mouse or touch input.",
|
||||
"homepage": "https://d3js.org/d3-drag/",
|
||||
"license": "BSD-3-Clause",
|
||||
"author": {
|
||||
"name": "Mike Bostock",
|
||||
"url": "http://bost.ocks.org/mike"
|
||||
},
|
||||
"main": "dist/d3-drag.js",
|
||||
"unpkg": "dist/d3-drag.min.js",
|
||||
"jsdelivr": "dist/d3-drag.min.js",
|
||||
"module": "src/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/d3/d3-drag.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"d3-dispatch": "1",
|
||||
"d3-selection": "1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "5",
|
||||
"rollup": "0.64",
|
||||
"rollup-plugin-terser": "1",
|
||||
"tape": "4"
|
||||
}
|
||||
}
|
||||
36
node_modules/d3-drag/rollup.config.js
generated
vendored
Normal file
36
node_modules/d3-drag/rollup.config.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
import {terser} from "rollup-plugin-terser";
|
||||
import * as meta from "./package.json";
|
||||
|
||||
const config = {
|
||||
input: "src/index.js",
|
||||
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
|
||||
output: {
|
||||
file: `dist/${meta.name}.js`,
|
||||
name: "d3",
|
||||
format: "umd",
|
||||
indent: false,
|
||||
extend: true,
|
||||
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
|
||||
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
|
||||
},
|
||||
plugins: []
|
||||
};
|
||||
|
||||
export default [
|
||||
config,
|
||||
{
|
||||
...config,
|
||||
output: {
|
||||
...config.output,
|
||||
file: `dist/${meta.name}.min.js`
|
||||
},
|
||||
plugins: [
|
||||
...config.plugins,
|
||||
terser({
|
||||
output: {
|
||||
preamble: config.output.banner
|
||||
}
|
||||
})
|
||||
]
|
||||
}
|
||||
];
|
||||
5
node_modules/d3-drag/src/constant.js
generated
vendored
Normal file
5
node_modules/d3-drag/src/constant.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export default function(x) {
|
||||
return function() {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
167
node_modules/d3-drag/src/drag.js
generated
vendored
Normal file
167
node_modules/d3-drag/src/drag.js
generated
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
import {dispatch} from "d3-dispatch";
|
||||
import {event, customEvent, select, mouse, touch} from "d3-selection";
|
||||
import nodrag, {yesdrag} from "./nodrag";
|
||||
import noevent, {nopropagation} from "./noevent";
|
||||
import constant from "./constant";
|
||||
import DragEvent from "./event";
|
||||
|
||||
// Ignore right-click, since that should open the context menu.
|
||||
function defaultFilter() {
|
||||
return !event.button;
|
||||
}
|
||||
|
||||
function defaultContainer() {
|
||||
return this.parentNode;
|
||||
}
|
||||
|
||||
function defaultSubject(d) {
|
||||
return d == null ? {x: event.x, y: event.y} : d;
|
||||
}
|
||||
|
||||
function defaultTouchable() {
|
||||
return "ontouchstart" in this;
|
||||
}
|
||||
|
||||
export default function() {
|
||||
var filter = defaultFilter,
|
||||
container = defaultContainer,
|
||||
subject = defaultSubject,
|
||||
touchable = defaultTouchable,
|
||||
gestures = {},
|
||||
listeners = dispatch("start", "drag", "end"),
|
||||
active = 0,
|
||||
mousedownx,
|
||||
mousedowny,
|
||||
mousemoving,
|
||||
touchending,
|
||||
clickDistance2 = 0;
|
||||
|
||||
function drag(selection) {
|
||||
selection
|
||||
.on("mousedown.drag", mousedowned)
|
||||
.filter(touchable)
|
||||
.on("touchstart.drag", touchstarted)
|
||||
.on("touchmove.drag", touchmoved)
|
||||
.on("touchend.drag touchcancel.drag", touchended)
|
||||
.style("touch-action", "none")
|
||||
.style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
|
||||
}
|
||||
|
||||
function mousedowned() {
|
||||
if (touchending || !filter.apply(this, arguments)) return;
|
||||
var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
|
||||
if (!gesture) return;
|
||||
select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
|
||||
nodrag(event.view);
|
||||
nopropagation();
|
||||
mousemoving = false;
|
||||
mousedownx = event.clientX;
|
||||
mousedowny = event.clientY;
|
||||
gesture("start");
|
||||
}
|
||||
|
||||
function mousemoved() {
|
||||
noevent();
|
||||
if (!mousemoving) {
|
||||
var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
|
||||
mousemoving = dx * dx + dy * dy > clickDistance2;
|
||||
}
|
||||
gestures.mouse("drag");
|
||||
}
|
||||
|
||||
function mouseupped() {
|
||||
select(event.view).on("mousemove.drag mouseup.drag", null);
|
||||
yesdrag(event.view, mousemoving);
|
||||
noevent();
|
||||
gestures.mouse("end");
|
||||
}
|
||||
|
||||
function touchstarted() {
|
||||
if (!filter.apply(this, arguments)) return;
|
||||
var touches = event.changedTouches,
|
||||
c = container.apply(this, arguments),
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
|
||||
nopropagation();
|
||||
gesture("start");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function touchmoved() {
|
||||
var touches = event.changedTouches,
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = gestures[touches[i].identifier]) {
|
||||
noevent();
|
||||
gesture("drag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function touchended() {
|
||||
var touches = event.changedTouches,
|
||||
n = touches.length, i, gesture;
|
||||
|
||||
if (touchending) clearTimeout(touchending);
|
||||
touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
|
||||
for (i = 0; i < n; ++i) {
|
||||
if (gesture = gestures[touches[i].identifier]) {
|
||||
nopropagation();
|
||||
gesture("end");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function beforestart(id, container, point, that, args) {
|
||||
var p = point(container, id), s, dx, dy,
|
||||
sublisteners = listeners.copy();
|
||||
|
||||
if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
|
||||
if ((event.subject = s = subject.apply(that, args)) == null) return false;
|
||||
dx = s.x - p[0] || 0;
|
||||
dy = s.y - p[1] || 0;
|
||||
return true;
|
||||
})) return;
|
||||
|
||||
return function gesture(type) {
|
||||
var p0 = p, n;
|
||||
switch (type) {
|
||||
case "start": gestures[id] = gesture, n = active++; break;
|
||||
case "end": delete gestures[id], --active; // nobreak
|
||||
case "drag": p = point(container, id), n = active; break;
|
||||
}
|
||||
customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
|
||||
};
|
||||
}
|
||||
|
||||
drag.filter = function(_) {
|
||||
return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), drag) : filter;
|
||||
};
|
||||
|
||||
drag.container = function(_) {
|
||||
return arguments.length ? (container = typeof _ === "function" ? _ : constant(_), drag) : container;
|
||||
};
|
||||
|
||||
drag.subject = function(_) {
|
||||
return arguments.length ? (subject = typeof _ === "function" ? _ : constant(_), drag) : subject;
|
||||
};
|
||||
|
||||
drag.touchable = function(_) {
|
||||
return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), drag) : touchable;
|
||||
};
|
||||
|
||||
drag.on = function() {
|
||||
var value = listeners.on.apply(listeners, arguments);
|
||||
return value === listeners ? drag : value;
|
||||
};
|
||||
|
||||
drag.clickDistance = function(_) {
|
||||
return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
|
||||
};
|
||||
|
||||
return drag;
|
||||
}
|
||||
17
node_modules/d3-drag/src/event.js
generated
vendored
Normal file
17
node_modules/d3-drag/src/event.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
export default function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
|
||||
this.target = target;
|
||||
this.type = type;
|
||||
this.subject = subject;
|
||||
this.identifier = id;
|
||||
this.active = active;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.dx = dx;
|
||||
this.dy = dy;
|
||||
this._ = dispatch;
|
||||
}
|
||||
|
||||
DragEvent.prototype.on = function() {
|
||||
var value = this._.on.apply(this._, arguments);
|
||||
return value === this._ ? this : value;
|
||||
};
|
||||
2
node_modules/d3-drag/src/index.js
generated
vendored
Normal file
2
node_modules/d3-drag/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export {default as drag} from "./drag";
|
||||
export {default as dragDisable, yesdrag as dragEnable} from "./nodrag";
|
||||
28
node_modules/d3-drag/src/nodrag.js
generated
vendored
Normal file
28
node_modules/d3-drag/src/nodrag.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
10
node_modules/d3-drag/src/noevent.js
generated
vendored
Normal file
10
node_modules/d3-drag/src/noevent.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import {event} from "d3-selection";
|
||||
|
||||
export function nopropagation() {
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
|
||||
export default function() {
|
||||
event.preventDefault();
|
||||
event.stopImmediatePropagation();
|
||||
}
|
||||
Reference in New Issue
Block a user