@daybrush/drag
Advanced tools
Comparing version 0.11.1 to 0.12.0
import { DragOptions, Client, OnDrag } from "./types"; | ||
export default class Dragger { | ||
declare class Dragger { | ||
private el; | ||
@@ -20,2 +20,3 @@ options: DragOptions; | ||
isDragging(): boolean; | ||
isFlag(): boolean; | ||
isPinching(): boolean; | ||
@@ -32,1 +33,2 @@ scrollBy(deltaX: number, deltaY: number, e: any, isCallDrag?: boolean): void; | ||
} | ||
export default Dragger; |
@@ -52,2 +52,3 @@ import { IObject } from "@daybrush/utils"; | ||
preventRightClick?: boolean; | ||
preventDefault?: boolean; | ||
pinchThreshold?: number; | ||
@@ -54,0 +55,0 @@ dragstart?: (options: OnDragStart) => any; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/drag.git | ||
version: 0.11.1 | ||
version: 0.12.0 | ||
*/ | ||
@@ -123,5 +123,12 @@ 'use strict'; | ||
/** | ||
* You can set up drag events in any browser. | ||
*/ | ||
var Dragger = | ||
/*#__PURE__*/ | ||
function () { | ||
/** | ||
* | ||
*/ | ||
function Dragger(el, options) { | ||
@@ -149,2 +156,5 @@ var _this = this; | ||
this.customDist = [0, 0]; | ||
/** | ||
* @method | ||
*/ | ||
@@ -181,3 +191,4 @@ this.onDragStart = function (e) { | ||
dragstart = _a.dragstart, | ||
preventRightClick = _a.preventRightClick; | ||
preventRightClick = _a.preventRightClick, | ||
preventDefault = _a.preventDefault; | ||
@@ -193,3 +204,3 @@ if (preventRightClick && e.which === 3 || (dragstart && dragstart(__assign({ | ||
_this.flag && e.preventDefault(); | ||
_this.flag && preventDefault && e.preventDefault(); | ||
}; | ||
@@ -247,2 +258,3 @@ | ||
preventRightClick: true, | ||
preventDefault: true, | ||
pinchThreshold: 0, | ||
@@ -273,3 +285,7 @@ events: ["touch", "mouse"] | ||
} | ||
/** | ||
* | ||
*/ | ||
var __proto = Dragger.prototype; | ||
@@ -280,7 +296,23 @@ | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isFlag = function () { | ||
return this.flag; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isPinching = function () { | ||
return this.isPinch; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.scrollBy = function (deltaX, deltaY, e, isCallDrag) { | ||
@@ -426,3 +458,7 @@ if (isCallDrag === void 0) { | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.unset = function () { | ||
@@ -429,0 +465,0 @@ var el = this.el; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/drag.git | ||
version: 0.11.1 | ||
version: 0.12.0 | ||
*/ | ||
@@ -121,5 +121,12 @@ import { removeEvent, addEvent } from '@daybrush/utils'; | ||
/** | ||
* You can set up drag events in any browser. | ||
*/ | ||
var Dragger = | ||
/*#__PURE__*/ | ||
function () { | ||
/** | ||
* | ||
*/ | ||
function Dragger(el, options) { | ||
@@ -147,2 +154,5 @@ var _this = this; | ||
this.customDist = [0, 0]; | ||
/** | ||
* @method | ||
*/ | ||
@@ -179,3 +189,4 @@ this.onDragStart = function (e) { | ||
dragstart = _a.dragstart, | ||
preventRightClick = _a.preventRightClick; | ||
preventRightClick = _a.preventRightClick, | ||
preventDefault = _a.preventDefault; | ||
@@ -191,3 +202,3 @@ if (preventRightClick && e.which === 3 || (dragstart && dragstart(__assign({ | ||
_this.flag && e.preventDefault(); | ||
_this.flag && preventDefault && e.preventDefault(); | ||
}; | ||
@@ -245,2 +256,3 @@ | ||
preventRightClick: true, | ||
preventDefault: true, | ||
pinchThreshold: 0, | ||
@@ -271,3 +283,7 @@ events: ["touch", "mouse"] | ||
} | ||
/** | ||
* | ||
*/ | ||
var __proto = Dragger.prototype; | ||
@@ -278,7 +294,23 @@ | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isFlag = function () { | ||
return this.flag; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isPinching = function () { | ||
return this.isPinch; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.scrollBy = function (deltaX, deltaY, e, isCallDrag) { | ||
@@ -424,3 +456,7 @@ if (isCallDrag === void 0) { | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.unset = function () { | ||
@@ -427,0 +463,0 @@ var el = this.el; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/drag.git | ||
version: 0.11.1 | ||
version: 0.12.0 | ||
*/ | ||
@@ -170,5 +170,12 @@ (function (global, factory) { | ||
/** | ||
* You can set up drag events in any browser. | ||
*/ | ||
var Dragger = | ||
/*#__PURE__*/ | ||
function () { | ||
/** | ||
* | ||
*/ | ||
function Dragger(el, options) { | ||
@@ -196,2 +203,5 @@ var _this = this; | ||
this.customDist = [0, 0]; | ||
/** | ||
* @method | ||
*/ | ||
@@ -228,3 +238,4 @@ this.onDragStart = function (e) { | ||
dragstart = _a.dragstart, | ||
preventRightClick = _a.preventRightClick; | ||
preventRightClick = _a.preventRightClick, | ||
preventDefault = _a.preventDefault; | ||
@@ -240,3 +251,3 @@ if (preventRightClick && e.which === 3 || (dragstart && dragstart(__assign({ | ||
_this.flag && e.preventDefault(); | ||
_this.flag && preventDefault && e.preventDefault(); | ||
}; | ||
@@ -294,2 +305,3 @@ | ||
preventRightClick: true, | ||
preventDefault: true, | ||
pinchThreshold: 0, | ||
@@ -320,3 +332,7 @@ events: ["touch", "mouse"] | ||
} | ||
/** | ||
* | ||
*/ | ||
var __proto = Dragger.prototype; | ||
@@ -327,7 +343,23 @@ | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isFlag = function () { | ||
return this.flag; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.isPinching = function () { | ||
return this.isPinch; | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.scrollBy = function (deltaX, deltaY, e, isCallDrag) { | ||
@@ -473,3 +505,7 @@ if (isCallDrag === void 0) { | ||
}; | ||
/** | ||
* | ||
*/ | ||
__proto.unset = function () { | ||
@@ -476,0 +512,0 @@ var el = this.el; |
@@ -7,5 +7,5 @@ /* | ||
repository: git+https://github.com/daybrush/drag.git | ||
version: 0.11.1 | ||
version: 0.12.0 | ||
*/ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).Dragger=i()}(this,function(){"use strict";var u=function(){return(u=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};function f(t,i,n,s){var e=d(t),a=d(i),r=d(s);return p(o(s[0],c(e,r)),o(s[0],c(a,r)),n[0])}function h(t){return t.touches?g(t.touches):[e(t)]}function p(t,i,n){var s=t.clientX,e=t.clientY;return{clientX:s,clientY:e,deltaX:s-i.clientX,deltaY:e-i.clientY,distX:s-n.clientX,distY:e-n.clientY}}function l(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function v(t,n,s){return t.map(function(t,i){return p(t,n[i],s[i])})}function g(t){for(var i=Math.min(t.length,2),n=[],s=0;s<i;++s)n.push(e(t[s]));return n}function e(t){return{clientX:t.clientX,clientY:t.clientY}}function d(t){return{clientX:(t[0].clientX+t[1].clientX)/2,clientY:(t[0].clientY+t[1].clientY)/2}}function o(t,i){return{clientX:t.clientX+i.clientX,clientY:t.clientY+i.clientY}}function c(t,i){return{clientX:t.clientX-i.clientX,clientY:t.clientY-i.clientY}}function C(t,i,n,s){t.addEventListener(i,n,s)}function n(t,i,n){t.removeEventListener(i,n)}var s=function(){function t(t,i){var a=this;void 0===i&&(i={}),this.el=t,this.options={},this.flag=!1,this.pinchFlag=!1,this.datas={},this.isDrag=!1,this.isPinch=!1,this.isMouse=!1,this.isTouch=!1,this.prevClients=[],this.startClients=[],this.movement=0,this.startPinchClients=[],this.startDistance=0,this.customDist=[0,0],this.onDragStart=function(t){if(a.flag||!1!==t.cancelable){if(function(t){return t.touches&&2<=t.touches.length}(t)){if(!a.flag&&t.touches.length!==t.changedTouches.length)return;a.pinchFlag||a.onPinchStart(t)}if(!a.flag){var i=a.startClients[0]?a.startClients:h(t);a.customDist=[0,0],a.flag=!0,a.isDrag=!1,a.startClients=i,a.prevClients=i,a.datas={};var n=p(i[a.movement=0],a.prevClients[0],a.startClients[0]),s=a.options,e=s.dragstart;(s.preventRightClick&&3===t.which||!1===(e&&e(u({datas:a.datas,inputEvent:t},n))))&&(a.startClients=[],a.prevClients=[],a.flag=!1),a.flag&&t.preventDefault()}}},this.onDrag=function(t,i){if(a.flag){var n=h(t);a.pinchFlag&&a.onPinch(t,n);var s=a.move([0,0],t,n);if(s&&(s.deltaX||s.deltaY)){var e=a.options.drag;e&&e(u({},s,{isScroll:!!i,inputEvent:t}))}}},this.onDragEnd=function(t){if(a.flag){a.pinchFlag&&a.onPinchEnd(t),a.flag=!1;var i=a.options.dragend,n=a.prevClients,s=a.startClients,e=a.pinchFlag?f(n,n,s,a.startPinchClients):p(n[0],n[0],s[0]);a.startClients=[],a.prevClients=[],i&&i(u({datas:a.datas,isDrag:a.isDrag,inputEvent:t},e))}},this.options=u({container:t,preventRightClick:!0,pinchThreshold:0,events:["touch","mouse"]},i);var n=this.options,s=n.container,e=n.events;if(this.isTouch=-1<e.indexOf("touch"),this.isMouse=-1<e.indexOf("mouse"),this.customDist=[0,0],this.isMouse&&(C(t,"mousedown",this.onDragStart),C(s,"mousemove",this.onDrag),C(s,"mouseup",this.onDragEnd)),this.isTouch){var r={passive:!1};C(t,"touchstart",this.onDragStart,r),C(s,"touchmove",this.onDrag,r),C(s,"touchend",this.onDragEnd,r)}}var i=t.prototype;return i.isDragging=function(){return this.isDrag},i.isPinching=function(){return this.isPinch},i.scrollBy=function(i,n,t,s){void 0===s&&(s=!0),this.flag&&(this.startClients.forEach(function(t){t.clientX-=i,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=i,t.clientY-=n}),s&&this.onDrag(t,!0))},i.move=function(t,i,n){var s=t[0],e=t[1];void 0===n&&(n=this.prevClients);var a=this.customDist,r=this.prevClients,h=this.startClients,o=this.pinchFlag?f(n,r,h,this.startPinchClients):p(n[0],r[0],h[0]);a[0]+=s,a[1]+=e,o.deltaX+=s,o.deltaY+=e;var c=o.deltaX,l=o.deltaY;return o.distX+=a[0],o.distY+=a[1],this.movement+=Math.sqrt(c*c+l*l),this.prevClients=n,this.isDrag=!0,u({datas:this.datas},o,{isScroll:!1,inputEvent:i})},i.onPinchStart=function(t){var i,n,s=this.options,e=s.pinchstart,a=s.pinchThreshold;if(!(this.isDrag&&this.movement>a)){var r=g(t.changedTouches);if(this.pinchFlag=!0,(i=this.startClients).push.apply(i,r),(n=this.prevClients).push.apply(n,r),this.startDistance=l(this.prevClients),this.startPinchClients=this.prevClients.slice(),e){var h=this.prevClients,o=d(h),c=p(o,o,o);e(u({datas:this.datas,touches:v(h,h,h)},c,{inputEvent:t}))}}},i.onPinch=function(t,i){if(this.flag&&this.pinchFlag){this.isPinch=!0;var n=this.options.pinch;if(n){var s=this.prevClients,e=this.startClients,a=p(d(i),d(s),d(e)),r=l(i);n(u({datas:this.datas,touches:v(i,s,e),scale:r/this.startDistance,distance:r},a,{inputEvent:t}))}}},i.onPinchEnd=function(t){if(this.flag&&this.pinchFlag){var i=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.options.pinchend;if(n){var s=this.prevClients,e=this.startClients,a=p(d(s),d(s),d(e));n(u({datas:this.datas,isPinch:i,touches:v(s,s,e)},a,{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}}},i.unset=function(){var t=this.el,i=this.options.container;this.isMouse&&(n(t,"mousedown",this.onDragStart),n(i,"mousemove",this.onDrag),n(i,"mouseup",this.onDragEnd)),this.isTouch&&(n(t,"touchstart",this.onDragStart),n(i,"touchmove",this.onDrag),n(i,"touchend",this.onDragEnd))},t}();var t={default:s,drag:function(t,i){return new s(t,i)}};for(var i in t)s[i]=t[i];return s}); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).Dragger=i()}(this,function(){"use strict";var u=function(){return(u=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};function f(t,i,n,s){var e=d(t),a=d(i),r=d(s);return p(h(s[0],c(e,r)),h(s[0],c(a,r)),n[0])}function o(t){return t.touches?g(t.touches):[e(t)]}function p(t,i,n){var s=t.clientX,e=t.clientY;return{clientX:s,clientY:e,deltaX:s-i.clientX,deltaY:e-i.clientY,distX:s-n.clientX,distY:e-n.clientY}}function l(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function v(t,n,s){return t.map(function(t,i){return p(t,n[i],s[i])})}function g(t){for(var i=Math.min(t.length,2),n=[],s=0;s<i;++s)n.push(e(t[s]));return n}function e(t){return{clientX:t.clientX,clientY:t.clientY}}function d(t){return{clientX:(t[0].clientX+t[1].clientX)/2,clientY:(t[0].clientY+t[1].clientY)/2}}function h(t,i){return{clientX:t.clientX+i.clientX,clientY:t.clientY+i.clientY}}function c(t,i){return{clientX:t.clientX-i.clientX,clientY:t.clientY-i.clientY}}function r(t,i,n,s){t.addEventListener(i,n,s)}function n(t,i,n){t.removeEventListener(i,n)}var s=function(){function t(t,i){var h=this;void 0===i&&(i={}),this.el=t,this.options={},this.flag=!1,this.pinchFlag=!1,this.datas={},this.isDrag=!1,this.isPinch=!1,this.isMouse=!1,this.isTouch=!1,this.prevClients=[],this.startClients=[],this.movement=0,this.startPinchClients=[],this.startDistance=0,this.customDist=[0,0],this.onDragStart=function(t){if(h.flag||!1!==t.cancelable){if(function(t){return t.touches&&2<=t.touches.length}(t)){if(!h.flag&&t.touches.length!==t.changedTouches.length)return;h.pinchFlag||h.onPinchStart(t)}if(!h.flag){var i=h.startClients[0]?h.startClients:o(t);h.customDist=[0,0],h.flag=!0,h.isDrag=!1,h.startClients=i,h.prevClients=i,h.datas={};var n=p(i[h.movement=0],h.prevClients[0],h.startClients[0]),s=h.options,e=s.dragstart,a=s.preventRightClick,r=s.preventDefault;(a&&3===t.which||!1===(e&&e(u({datas:h.datas,inputEvent:t},n))))&&(h.startClients=[],h.prevClients=[],h.flag=!1),h.flag&&r&&t.preventDefault()}}},this.onDrag=function(t,i){if(h.flag){var n=o(t);h.pinchFlag&&h.onPinch(t,n);var s=h.move([0,0],t,n);if(s&&(s.deltaX||s.deltaY)){var e=h.options.drag;e&&e(u({},s,{isScroll:!!i,inputEvent:t}))}}},this.onDragEnd=function(t){if(h.flag){h.pinchFlag&&h.onPinchEnd(t),h.flag=!1;var i=h.options.dragend,n=h.prevClients,s=h.startClients,e=h.pinchFlag?f(n,n,s,h.startPinchClients):p(n[0],n[0],s[0]);h.startClients=[],h.prevClients=[],i&&i(u({datas:h.datas,isDrag:h.isDrag,inputEvent:t},e))}},this.options=u({container:t,preventRightClick:!0,preventDefault:!0,pinchThreshold:0,events:["touch","mouse"]},i);var n=this.options,s=n.container,e=n.events;if(this.isTouch=-1<e.indexOf("touch"),this.isMouse=-1<e.indexOf("mouse"),this.customDist=[0,0],this.isMouse&&(r(t,"mousedown",this.onDragStart),r(s,"mousemove",this.onDrag),r(s,"mouseup",this.onDragEnd)),this.isTouch){var a={passive:!1};r(t,"touchstart",this.onDragStart,a),r(s,"touchmove",this.onDrag,a),r(s,"touchend",this.onDragEnd,a)}}var i=t.prototype;return i.isDragging=function(){return this.isDrag},i.isFlag=function(){return this.flag},i.isPinching=function(){return this.isPinch},i.scrollBy=function(i,n,t,s){void 0===s&&(s=!0),this.flag&&(this.startClients.forEach(function(t){t.clientX-=i,t.clientY-=n}),this.prevClients.forEach(function(t){t.clientX-=i,t.clientY-=n}),s&&this.onDrag(t,!0))},i.move=function(t,i,n){var s=t[0],e=t[1];void 0===n&&(n=this.prevClients);var a=this.customDist,r=this.prevClients,h=this.startClients,o=this.pinchFlag?f(n,r,h,this.startPinchClients):p(n[0],r[0],h[0]);a[0]+=s,a[1]+=e,o.deltaX+=s,o.deltaY+=e;var c=o.deltaX,l=o.deltaY;return o.distX+=a[0],o.distY+=a[1],this.movement+=Math.sqrt(c*c+l*l),this.prevClients=n,this.isDrag=!0,u({datas:this.datas},o,{isScroll:!1,inputEvent:i})},i.onPinchStart=function(t){var i,n,s=this.options,e=s.pinchstart,a=s.pinchThreshold;if(!(this.isDrag&&this.movement>a)){var r=g(t.changedTouches);if(this.pinchFlag=!0,(i=this.startClients).push.apply(i,r),(n=this.prevClients).push.apply(n,r),this.startDistance=l(this.prevClients),this.startPinchClients=this.prevClients.slice(),e){var h=this.prevClients,o=d(h),c=p(o,o,o);e(u({datas:this.datas,touches:v(h,h,h)},c,{inputEvent:t}))}}},i.onPinch=function(t,i){if(this.flag&&this.pinchFlag){this.isPinch=!0;var n=this.options.pinch;if(n){var s=this.prevClients,e=this.startClients,a=p(d(i),d(s),d(e)),r=l(i);n(u({datas:this.datas,touches:v(i,s,e),scale:r/this.startDistance,distance:r},a,{inputEvent:t}))}}},i.onPinchEnd=function(t){if(this.flag&&this.pinchFlag){var i=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var n=this.options.pinchend;if(n){var s=this.prevClients,e=this.startClients,a=p(d(s),d(s),d(e));n(u({datas:this.datas,isPinch:i,touches:v(s,s,e)},a,{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}}},i.unset=function(){var t=this.el,i=this.options.container;this.isMouse&&(n(t,"mousedown",this.onDragStart),n(i,"mousemove",this.onDrag),n(i,"mouseup",this.onDragEnd)),this.isTouch&&(n(t,"touchstart",this.onDragStart),n(i,"touchmove",this.onDrag),n(i,"touchend",this.onDragEnd))},t}();var t={default:s,drag:function(t,i){return new s(t,i)}};for(var i in t)s[i]=t[i];return s}); | ||
//# sourceMappingURL=drag.min.js.map |
{ | ||
"name": "@daybrush/drag", | ||
"version": "0.11.1", | ||
"version": "0.12.0", | ||
"description": "You can set up drag events in any browser.", | ||
@@ -13,4 +13,7 @@ "main": "./dist/drag.cjs.js", | ||
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json", | ||
"release": "npm run build && release", | ||
"release:init": "npm run build && release -i" | ||
"doc": "rm -rf ./doc && jsdoc -c jsdoc.json", | ||
"release": "npm run build && npm run doc && release --dirs=dist,doc", | ||
"release:init": "npm run build && npm run doc && release -i --dirs=dist,doc", | ||
"deploy": "gh-pages -d ./demo --dest=./ --add --remote origin", | ||
"prerelease": "npm run build && prerelease --dirs=dist,doc" | ||
}, | ||
@@ -36,3 +39,5 @@ "keywords": [ | ||
"@daybrush/builder": "^0.1.1", | ||
"@daybrush/jsdoc": "^0.3.7", | ||
"@daybrush/release": "^0.2.4", | ||
"daybrush-jsdoc-template": "^1.6.0", | ||
"print-sizes": "^0.1.0", | ||
@@ -39,0 +44,0 @@ "tslint": "^5.15.0", |
@@ -10,2 +10,3 @@ <p align="middle" ><img src="https://github.com/daybrush/drag/raw/master/demo/images/logo.png" /></p> | ||
* [API Documentation](https://daybrush.com/drag/release/latest/doc/) | ||
@@ -12,0 +13,0 @@ ## ⚙️ Installation |
@@ -8,3 +8,6 @@ import { DragOptions, Client, Position, OnDrag } from "./types"; | ||
export default class Dragger { | ||
/** | ||
* You can set up drag events in any browser. | ||
*/ | ||
class Dragger { | ||
public options: DragOptions = {}; | ||
@@ -24,3 +27,5 @@ private flag = false; | ||
private customDist = [0, 0]; | ||
/** | ||
* | ||
*/ | ||
constructor(private el: Element, options: DragOptions = {}) { | ||
@@ -30,2 +35,3 @@ this.options = { | ||
preventRightClick: true, | ||
preventDefault: true, | ||
pinchThreshold: 0, | ||
@@ -56,8 +62,23 @@ events: ["touch", "mouse"], | ||
} | ||
/** | ||
* | ||
*/ | ||
public isDragging() { | ||
return this.isDrag; | ||
} | ||
/** | ||
* | ||
*/ | ||
public isFlag() { | ||
return this.flag; | ||
} | ||
/** | ||
* | ||
*/ | ||
public isPinching() { | ||
return this.isPinch; | ||
} | ||
/** | ||
* | ||
*/ | ||
public scrollBy(deltaX: number, deltaY: number, e: any, isCallDrag: boolean = true) { | ||
@@ -77,2 +98,5 @@ if (!this.flag) { | ||
} | ||
/** | ||
* @method | ||
*/ | ||
public onDragStart = (e: any) => { | ||
@@ -108,2 +132,3 @@ if (!this.flag && e.cancelable === false) { | ||
preventRightClick, | ||
preventDefault, | ||
} = this.options; | ||
@@ -122,3 +147,3 @@ | ||
} | ||
this.flag && e.preventDefault(); | ||
this.flag && preventDefault && e.preventDefault(); | ||
} | ||
@@ -293,2 +318,5 @@ public onDrag = (e: any, isScroll?: boolean) => { | ||
} | ||
/** | ||
* | ||
*/ | ||
public unset() { | ||
@@ -310,1 +338,3 @@ const el = this.el; | ||
} | ||
export default Dragger; |
import { IObject } from "@daybrush/utils"; | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
*/ | ||
export interface Client { | ||
@@ -7,2 +11,6 @@ clientX: number; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
*/ | ||
export interface Dist { | ||
@@ -12,2 +20,6 @@ distX: number; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
*/ | ||
export interface Delta { | ||
@@ -17,3 +29,15 @@ deltaX: number; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Client | ||
* @extends Dragger.Dist | ||
* @extends Dragger.Delta | ||
*/ | ||
export interface Position extends Client, Dist, Delta {} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnDragStart extends Position { | ||
@@ -23,2 +47,7 @@ datas: IObject<any>; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnDrag extends Position { | ||
@@ -29,2 +58,7 @@ datas: IObject<any>; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnDragEnd extends Position { | ||
@@ -35,2 +69,7 @@ isDrag: boolean; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnPinchStart extends Position { | ||
@@ -41,2 +80,7 @@ datas: IObject<any>; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnPinch extends Position { | ||
@@ -49,2 +93,7 @@ datas: IObject<any>; | ||
} | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
* @extends Dragger.Position | ||
*/ | ||
export interface OnPinchEnd extends Position { | ||
@@ -57,2 +106,6 @@ isPinch: boolean; | ||
/** | ||
* @typedef | ||
* @memberof Dragger | ||
*/ | ||
export interface DragOptions { | ||
@@ -62,2 +115,3 @@ container?: Window | Node | Element; | ||
preventRightClick?: boolean; | ||
preventDefault?: boolean; | ||
pinchThreshold?: number; | ||
@@ -64,0 +118,0 @@ dragstart?: (options: OnDragStart) => any; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
171918
30
2113
101
7