Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-drag

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-drag - npm Package Compare versions

Comparing version 2.0.0-rc.1 to 2.0.0

2

dist/d3-drag.js

@@ -1,2 +0,2 @@

// https://d3js.org/d3-drag/ v2.0.0-rc.1 Copyright 2020 Mike Bostock
// https://d3js.org/d3-drag/ v2.0.0 Copyright 2020 Mike Bostock
(function (global, factory) {

@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-dispatch'), require('d3-selection')) :

@@ -1,2 +0,2 @@

// https://d3js.org/d3-drag/ v2.0.0-rc.1 Copyright 2020 Mike Bostock
// https://d3js.org/d3-drag/ v2.0.0 Copyright 2020 Mike Bostock
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-dispatch"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-selection"],t):t((e=e||self).d3=e.d3||{},e.d3,e.d3)}(this,function(e,t,n){"use strict";function o(e){e.stopImmediatePropagation()}function r(e){e.preventDefault(),e.stopImmediatePropagation()}function i(e){var t=e.document.documentElement,o=n.select(e).on("dragstart.drag",r,!0);"onselectstart"in t?o.on("selectstart.drag",r,!0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function a(e,t){var o=e.document.documentElement,i=n.select(e).on("dragstart.drag",null);t&&(i.on("click.drag",r,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}var u=e=>()=>e;function c(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:s}})}function l(e){return!e.ctrlKey&&!e.button}function s(){return this.parentNode}function d(e,t){return null==t?{x:e.x,y:e.y}:t}function f(){return navigator.maxTouchPoints||"ontouchstart"in this}c.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},e.drag=function(){var e,g,h,v,m=l,p=s,b=d,y=f,x={},_=t.dispatch("start","drag","end"),w=0,j=0;function E(e){e.on("mousedown.drag",T).filter(y).on("touchstart.drag",P).on("touchmove.drag",q).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function T(t,r){if(!v&&m.call(this,t,r)){var a=D(this,p.call(this,t,r),t,r,"mouse");a&&(n.select(t.view).on("mousemove.drag",k,!0).on("mouseup.drag",M,!0),i(t.view),o(t),h=!1,e=t.clientX,g=t.clientY,a("start",t))}}function k(t){if(r(t),!h){var n=t.clientX-e,o=t.clientY-g;h=n*n+o*o>j}x.mouse("drag",t)}function M(e){n.select(e.view).on("mousemove.drag mouseup.drag",null),a(e.view,h),r(e),x.mouse("end",e)}function P(e,t){if(m.call(this,e,t)){var n,r,i=e.changedTouches,a=p.call(this,e,t),u=i.length;for(n=0;n<u;++n)(r=D(this,a,e,t,i[n].identifier,i[n]))&&(o(e),r("start",e,i[n]))}}function q(e){var t,n,o=e.changedTouches,i=o.length;for(t=0;t<i;++t)(n=x[o[t].identifier])&&(r(e),n("drag",e,o[t]))}function z(e){var t,n,r=e.changedTouches,i=r.length;for(v&&clearTimeout(v),v=setTimeout(function(){v=null},500),t=0;t<i;++t)(n=x[r[t].identifier])&&(o(e),n("end",e,r[t]))}function D(e,t,o,r,i,a){var u,l,s,d=_.copy(),f=n.pointer(a||o,t);if(null!=(s=b.call(e,new c("beforestart",{sourceEvent:o,target:E,identifier:i,active:w,x:f[0],y:f[1],dx:0,dy:0,dispatch:d}),r)))return u=s.x-f[0]||0,l=s.y-f[1]||0,function o(a,g,h){var v,m=f;switch(a){case"start":x[i]=o,v=w++;break;case"end":delete x[i],--w;case"drag":f=n.pointer(h||g,t),v=w}d.call(a,e,new c(a,{sourceEvent:g,subject:s,target:E,identifier:i,active:v,x:f[0]+u,y:f[1]+l,dx:f[0]-m[0],dy:f[1]-m[1],dispatch:d}),r)}}return E.filter=function(e){return arguments.length?(m="function"==typeof e?e:u(!!e),E):m},E.container=function(e){return arguments.length?(p="function"==typeof e?e:u(e),E):p},E.subject=function(e){return arguments.length?(b="function"==typeof e?e:u(e),E):b},E.touchable=function(e){return arguments.length?(y="function"==typeof e?e:u(!!e),E):y},E.on=function(){var e=_.on.apply(_,arguments);return e===_?E:e},E.clickDistance=function(e){return arguments.length?(j=(e=+e)*e,E):Math.sqrt(j)},E},e.dragDisable=i,e.dragEnable=a,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "d3-drag",
"version": "2.0.0-rc.1",
"publishConfig": {
"tag": "next"
},
"version": "2.0.0",
"description": "Drag and drop SVG, HTML or Canvas using mouse or touch input.",

@@ -40,4 +37,4 @@ "keywords": [

"dependencies": {
"d3-dispatch": ">=2.0.0-rc.1",
"d3-selection": ">=2.0.0-rc.3"
"d3-dispatch": "1 - 2",
"d3-selection": "2"
},

@@ -44,0 +41,0 @@ "sideEffects": false,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc