Comparing version 0.2.0 to 0.2.1
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var version = "0.2.0"; | ||
var version = "0.2.1"; | ||
@@ -51,3 +51,4 @@ function nopropagation() { | ||
function DragEvent(type, subject, id, active, x, y, dx, dy, dispatch) { | ||
function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) { | ||
this.target = target; | ||
this.type = type; | ||
@@ -169,3 +170,3 @@ this.subject = subject; | ||
if (!d3Selection.customEvent(new DragEvent("beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() { | ||
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; | ||
@@ -184,3 +185,3 @@ dx = s.x - p[0] || 0; | ||
} | ||
d3Selection.customEvent(new DragEvent(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]); | ||
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]); | ||
}; | ||
@@ -187,0 +188,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!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.d3_drag=e.d3_drag||{},e.d3_dispatch,e.d3_selection)}(this,function(e,t,n){"use strict";function o(){n.event.stopImmediatePropagation()}function i(){n.event.preventDefault(),n.event.stopImmediatePropagation()}function r(e){var t=e.document.documentElement,o=n.select(e).on("dragstart.drag",i,!0);"onselectstart"in t?o.on("selectstart.drag",i,!0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function c(e,t){var o=e.document.documentElement,r=n.select(e).on("dragstart.drag",null);t&&(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(e){return function(){return e}}function s(e,t,n,o,i,r,c,u,s){this.type=e,this.subject=t,this.identifier=n,this.active=o,this.x=i,this.y=r,this.dx=c,this.dy=u,this._=s}function a(){return!n.event.button}function d(){return this.parentNode}function l(e){return null==e?{x:n.event.x,y:n.event.y}:e}function f(){function e(e){e.on("mousedown.drag",f).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!b&&w.apply(this,arguments)){var e=y("mouse",x.apply(this,arguments),n.mouse,this,arguments);e&&(n.select(n.event.view).on("mousemove.drag",h,!0).on("mouseup.drag",p,!0),r(n.event.view),o(),_=!1,e("start"))}}function h(){i(),_=!0,E.mouse("drag")}function p(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),c(n.event.view,_),i(),E.mouse("end")}function g(){if(w.apply(this,arguments)){var e,t,i=n.event.changedTouches,r=x.apply(this,arguments),c=i.length;for(o(),e=0;c>e;++e)(t=y(i[e].identifier,r,n.touch,this,arguments))&&t("start")}}function v(){var e,t,o=n.event.changedTouches,r=o.length;for(i(),e=0;r>e;++e)(t=E[o[e].identifier])&&t("drag")}function m(){var e,t,i=n.event.changedTouches,r=i.length;for(o(),b&&clearTimeout(b),b=setTimeout(function(){b=null},500),e=0;r>e;++e)(t=E[i[e].identifier])&&t("end")}function y(e,t,o,i,r){var c,u,a,d=o(t,e),l=j.copy();if(n.customEvent(new s("beforestart",c,e,k,d[0],d[1],0,0,l),function(){return null==(n.event.subject=c=T.apply(i,r))?!1:(u=c.x-d[0]||0,a=c.y-d[1]||0,!0)}))return function f(h){var p,g=d;switch(h){case"start":E[e]=f,p=k++;break;case"end":delete E[e],--k;case"drag":d=o(t,e),p=k}n.customEvent(new s(h,c,e,p,d[0]+u,d[1]+a,d[0]-g[0],d[1]-g[1],l),l.apply,l,[h,i,r])}}var _,b,w=a,x=d,T=l,E={},j=t.dispatch("start","drag","end"),k=0;return e.filter=function(t){return arguments.length?(w="function"==typeof t?t:u(!!t),e):w},e.container=function(t){return arguments.length?(x="function"==typeof t?t:u(t),e):x},e.subject=function(t){return arguments.length?(T="function"==typeof t?t:u(t),e):T},e.on=function(){var t=j.on.apply(j,arguments);return t===j?e:t},e}var h="0.2.0";s.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},e.version=h,e.drag=f,e.dragDisable=r,e.dragEnable=c}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("d3-dispatch"),require("d3-selection")):"function"==typeof define&&define.amd?define(["exports","d3-dispatch","d3-selection"],e):e(t.d3_drag=t.d3_drag||{},t.d3_dispatch,t.d3_selection)}(this,function(t,e,n){"use strict";function o(){n.event.stopImmediatePropagation()}function i(){n.event.preventDefault(),n.event.stopImmediatePropagation()}function r(t){var e=t.document.documentElement,o=n.select(t).on("dragstart.drag",i,!0);"onselectstart"in e?o.on("selectstart.drag",i,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function c(t,e){var o=t.document.documentElement,r=n.select(t).on("dragstart.drag",null);e&&(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!n.event.button}function d(){return this.parentNode}function l(t){return null==t?{x:n.event.x,y:n.event.y}:t}function f(){function t(t){t.on("mousedown.drag",f).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",m).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!b&&w.apply(this,arguments)){var t=y("mouse",x.apply(this,arguments),n.mouse,this,arguments);t&&(n.select(n.event.view).on("mousemove.drag",h,!0).on("mouseup.drag",p,!0),r(n.event.view),o(),_=!1,t("start"))}}function h(){i(),_=!0,E.mouse("drag")}function p(){n.select(n.event.view).on("mousemove.drag mouseup.drag",null),c(n.event.view,_),i(),E.mouse("end")}function g(){if(w.apply(this,arguments)){var t,e,i=n.event.changedTouches,r=x.apply(this,arguments),c=i.length;for(o(),t=0;c>t;++t)(e=y(i[t].identifier,r,n.touch,this,arguments))&&e("start")}}function v(){var t,e,o=n.event.changedTouches,r=o.length;for(i(),t=0;r>t;++t)(e=E[o[t].identifier])&&e("drag")}function m(){var t,e,i=n.event.changedTouches,r=i.length;for(o(),b&&clearTimeout(b),b=setTimeout(function(){b=null},500),t=0;r>t;++t)(e=E[i[t].identifier])&&e("end")}function y(e,o,i,r,c){var u,a,d,l=i(o,e),f=j.copy();if(n.customEvent(new s(t,"beforestart",u,e,k,l[0],l[1],0,0,f),function(){return null==(n.event.subject=u=T.apply(r,c))?!1:(a=u.x-l[0]||0,d=u.y-l[1]||0,!0)}))return function h(p){var g,v=l;switch(p){case"start":E[e]=h,g=k++;break;case"end":delete E[e],--k;case"drag":l=i(o,e),g=k}n.customEvent(new s(t,p,u,e,g,l[0]+a,l[1]+d,l[0]-v[0],l[1]-v[1],f),f.apply,f,[p,r,c])}}var _,b,w=a,x=d,T=l,E={},j=e.dispatch("start","drag","end"),k=0;return t.filter=function(e){return arguments.length?(w="function"==typeof e?e:u(!!e),t):w},t.container=function(e){return arguments.length?(x="function"==typeof e?e:u(e),t):x},t.subject=function(e){return arguments.length?(T="function"==typeof e?e:u(e),t):T},t.on=function(){var e=j.on.apply(j,arguments);return e===j?t:e},t}var h="0.2.1";s.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t},t.version=h,t.drag=f,t.dragDisable=r,t.dragEnable=c}); |
export var name = "d3-drag"; | ||
export var version = "0.2.0"; | ||
export var version = "0.2.1"; | ||
export var description = "Drag and drop SVG, HTML or Canvas using mouse or touch input."; | ||
@@ -4,0 +4,0 @@ export var keywords = ["d3","drag","behavior","interaction"]; |
{ | ||
"name": "d3-drag", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Drag and drop SVG, HTML or Canvas using mouse or touch input.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -182,2 +182,3 @@ # d3-drag | ||
* `target - the associated [drag behavior](#drag). | ||
* `type` - the string “start”, “drag” or “end”; see [*drag*.on](#drag_on). | ||
@@ -184,0 +185,0 @@ * `subject` - the drag subject, defined by [*drag*.subject](#drag_subject). |
@@ -108,3 +108,3 @@ import {dispatch} from "d3-dispatch"; | ||
if (!customEvent(new DragEvent("beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() { | ||
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; | ||
@@ -123,3 +123,3 @@ dx = s.x - p[0] || 0; | ||
} | ||
customEvent(new DragEvent(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]); | ||
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]); | ||
}; | ||
@@ -126,0 +126,0 @@ } |
@@ -1,2 +0,3 @@ | ||
export default function DragEvent(type, subject, id, active, x, y, dx, dy, dispatch) { | ||
export default function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) { | ||
this.target = target; | ||
this.type = type; | ||
@@ -3,0 +4,0 @@ this.subject = subject; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
211567
372
216