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

gesto

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gesto - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

8

dist/gesto.cjs.js

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/gesture.git
version: 1.0.0
version: 1.0.1
*/

@@ -630,3 +630,3 @@ 'use strict';

this.clientStores.splice(0, 0, store);
this.trigger("pinchStart", __assign({
var result = this.trigger("pinchStart", __assign({
datas: this.datas,

@@ -638,2 +638,6 @@ angle: store.getAngle(),

}));
if (result === false) {
this.pinchFlag = false;
}
};

@@ -640,0 +644,0 @@

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/gesture.git
version: 1.0.0
version: 1.0.1
*/

@@ -628,3 +628,3 @@ import Component from '@egjs/component';

this.clientStores.splice(0, 0, store);
this.trigger("pinchStart", __assign({
var result = this.trigger("pinchStart", __assign({
datas: this.datas,

@@ -636,2 +636,6 @@ angle: store.getAngle(),

}));
if (result === false) {
this.pinchFlag = false;
}
};

@@ -638,0 +642,0 @@

@@ -7,3 +7,3 @@ /*

repository: git+https://github.com/daybrush/gesture.git
version: 1.0.0
version: 1.0.1
*/

@@ -979,3 +979,3 @@ (function (global, factory) {

this.clientStores.splice(0, 0, store);
this.trigger("pinchStart", __assign({
var result = this.trigger("pinchStart", __assign({
datas: this.datas,

@@ -987,2 +987,6 @@ angle: store.getAngle(),

}));
if (result === false) {
this.pinchFlag = false;
}
};

@@ -989,0 +993,0 @@

@@ -7,5 +7,5 @@ /*

repository: git+https://github.com/daybrush/gesture.git
version: 1.0.0
version: 1.0.1
*/
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Gesto=n()}(this,function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])})(t,n)};var m=function(){return(m=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function i(t){return function(t,n){var i=n[0]-t[0],e=n[1]-t[1],r=Math.atan2(e,i);return 0<=r?r:r+2*Math.PI}([t[0].clientX,t[0].clientY],[t[1].clientX,t[1].clientY])/Math.PI*180}function D(t){return t.touches?function(t){for(var n=Math.min(t.length,2),i=[],e=0;e<n;++e)i.push(s(t[e]));return i}(t.touches):[s(t)]}function r(t,n,i){var e=i.length,r=f(t,e),o=r.clientX,s=r.clientY,a=r.originalClientX,c=r.originalClientY,h=f(n,e),l=h.clientX,u=h.clientY,g=f(i,e);return{clientX:a,clientY:c,deltaX:o-l,deltaY:s-u,distX:o-g.clientX,distY:s-g.clientY}}function o(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function s(t){return{clientX:t.clientX,clientY:t.clientY}}function f(t,n){void 0===n&&(n=t.length);for(var i={clientX:0,clientY:0,originalClientX:0,originalClientY:0},e=0;e<n;++e){var r=t[e];i.originalClientX+="originalClientX"in r?r.originalClientX:r.clientX,i.originalClientY+="originalClientY"in r?r.originalClientY:r.clientY,i.clientX+=r.clientX,i.clientY+=r.clientY}return n?{clientX:i.clientX/n,clientY:i.clientY/n,originalClientX:i.originalClientX/n,originalClientY:i.originalClientY/n}:i}function a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var n=t.prototype;return n.trigger=function(t,n){void 0===n&&(n={});var i=this._eventHandler[t]||[];if(!(0<i.length))return!0;i=i.concat(),n.eventType=t;var e=!1,r=[n],o=0;n.stop=function(){e=!0},n.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];for(1<=a.length&&(r=r.concat(a)),o=0;i[o];o++)i[o].apply(this,r);return!e},n.once=function(r,o){if("object"==typeof r&&a(o)){var t,n=r;for(t in n)this.once(t,n[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];o.apply(s,i),s.off(r,t)})}return this},n.hasOn=function(t){return!!this._eventHandler[t]},n.on=function(t,n){if("object"==typeof t&&a(n)){var i,e=t;for(i in e)this.on(i,e[i]);return this}if("string"==typeof t&&"function"==typeof n){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(n)}return this},n.off=function(t,n){if(a(t))return this._eventHandler={},this;if(a(n)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var i,e=t;for(i in e)this.off(i,e[i]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===n){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function S(){return Date.now?Date.now():(new Date).getTime()}function P(t,n,i,e){t.addEventListener(n,i,e)}function X(t,n,i){t.removeEventListener(n,i)}var Y=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var n=t.prototype;return n.addClients=function(t){void 0===t&&(t=this.prevClients);var n=this.getPosition(t),i=n.deltaX,e=n.deltaY;return this.movement+=Math.sqrt(i*i+e*e),this.prevClients=t,n},n.getAngle=function(t){return void 0===t&&(t=this.prevClients),i(t)},n.getRotation=function(t){return void 0===t&&(t=this.prevClients),i(t)-i(this.startClients)},n.getPosition=function(t){return r(t||this.prevClients,this.prevClients,this.startClients)},n.getPositions=function(i){void 0===i&&(i=this.prevClients);var e=this.prevClients;return this.startClients.map(function(t,n){return r([i[n]],[e[n]],[t])})},n.getMovement=function(t){var n=this.movement;if(!t)return n;var i=f(t,this.length),e=f(this.prevClients,this.length),r=i.clientX-e.clientX,o=i.clientY-e.clientY;return Math.sqrt(r*r+o*o)+n},n.getDistance=function(t){return void 0===t&&(t=this.prevClients),o(t)},n.getScale=function(t){return void 0===t&&(t=this.prevClients),o(t)/o(this.startClients)},n.move=function(n,i){this.startClients.forEach(function(t){t.clientX-=n,t.clientY-=i}),this.prevClients.forEach(function(t){t.clientX-=n,t.clientY-=i})},t}(),E=["textarea","input"],n=function(a){function t(t,n){void 0===n&&(n={});var C=a.call(this)||this;C.options={},C.flag=!1,C.pinchFlag=!1,C.datas={},C.isDrag=!1,C.isPinch=!1,C.isMouse=!1,C.isTouch=!1,C.clientStores=[],C.targets=[],C.prevTime=0,C.isDouble=!1,C.onDragStart=function(t,n){if(void 0===n&&(n=!0),C.flag||!1!==t.cancelable){var i=C.options,e=i.container,r=i.pinchOutside,o=i.preventRightClick,s=i.preventDefault,a=i.checkInput,c=C.isTouch,h=!C.flag;if(h){var l=document.activeElement,u=t.target,g=u.tagName.toLowerCase(),f=-1<E.indexOf(g),v=u.isContentEditable;if(f||v){if(a||l===u)return!1;if(l&&v&&l.isContentEditable&&l.contains(u))return!1}else if((s||"touchstart"===t.type)&&l){var p=l.tagName;(l.isContentEditable||-1<E.indexOf(p))&&l.blur()}if(C.clientStores=[new Y(D(t))],C.flag=!0,C.isDrag=!1,C.datas={},o&&(3===t.which||2===t.button))return C.initDrag(),!1;!1===C.trigger("dragStart",m({datas:C.datas,inputEvent:t,isTrusted:n},C.getCurrentStore().getPosition()))&&C.initDrag(),C.isDouble=S()-C.prevTime<200,C.flag&&s&&t.preventDefault()}if(!C.flag)return!1;var d=0;if(h&&c&&r&&(d=setTimeout(function(){P(e,"touchstart",C.onDragStart,{passive:!1})})),!h&&c&&r&&X(e,"touchstart",C.onDragStart),C.flag&&function(t){return t.touches&&2<=t.touches.length}(t)){if(clearTimeout(d),h&&t.touches.length!==t.changedTouches.length)return;C.pinchFlag||C.onPinchStart(t)}}},C.onDrag=function(t,n){if(C.flag){var i=D(t),e=C.moveClients(i,t,!1);(C.pinchFlag||e.deltaX||e.deltaY)&&C.trigger("drag",m({},e,{isScroll:!!n,inputEvent:t})),C.pinchFlag&&C.onPinch(t,i),C.getCurrentStore().addClients(i)}},C.onDragEnd=function(t){if(C.flag){var n=C.options,i=n.pinchOutside,e=n.container;C.isTouch&&i&&X(e,"touchstart",C.onDragStart),C.flag=!1;var r=C.getCurrentStore().getPosition(),o=S(),s=!C.isDrag&&C.isDouble;C.prevTime=C.isDrag||s?0:o,C.trigger("dragEnd",m({datas:C.datas,isDouble:s,isDrag:C.isDrag,inputEvent:t},r)),C.pinchFlag&&C.onPinchEnd(t),C.clientStores=[]}};var i=[].concat(t);C.options=m({checkInput:!1,container:1<i.length?window:i[0],preventRightClick:!0,preventDefault:!0,pinchThreshold:0,events:["touch","mouse"]},n);var e=C.options,r=e.container,o=e.events;if(C.isTouch=-1<o.indexOf("touch"),C.isMouse=-1<o.indexOf("mouse"),C.targets=i,C.isMouse&&(i.forEach(function(t){P(t,"mousedown",C.onDragStart)}),P(r,"mousemove",C.onDrag),P(r,"mouseup",C.onDragEnd),P(r,"contextmenu",C.onDragEnd)),C.isTouch){var s={passive:!1};i.forEach(function(t){P(t,"touchstart",C.onDragStart,s)}),P(r,"touchmove",C.onDrag,s),P(r,"touchend",C.onDragEnd,s),P(r,"touchcancel",C.onDragEnd,s)}return C}!function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}(t,a);var n=t.prototype;return n.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,n){return t+n.movement},0)},n.isDragging=function(){return this.isDrag},n.isFlag=function(){return this.flag},n.isPinchFlag=function(){return this.pinchFlag},n.isPinching=function(){return this.isPinch},n.scrollBy=function(t,n,i,e){void 0===e&&(e=!0),this.flag&&(this.clientStores[0].move(t,n),e&&this.onDrag(i,!0))},n.move=function(t,n){var e=t[0],r=t[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map(function(t){var n=t.clientX,i=t.clientY;return{clientX:n+e,clientY:i+r,originalClientX:n,originalClientY:i}}),n,!0)},n.triggerDragStart=function(t){this.onDragStart(t,!1)},n.unset=function(){var n=this,t=this.targets,i=this.options.container;this.off(),this.isMouse&&(t.forEach(function(t){X(t,"mousedown",n.onDragStart)}),X(i,"mousemove",this.onDrag),X(i,"mouseup",this.onDragEnd),X(i,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){X(t,"touchstart",n.onDragStart)}),X(i,"touchstart",this.onDragStart),X(i,"touchmove",this.onDrag),X(i,"touchend",this.onDragEnd),X(i,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var n=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>n)){var i=new Y(D(t));this.pinchFlag=!0,this.clientStores.splice(0,0,i),this.trigger("pinchStart",m({datas:this.datas,angle:i.getAngle(),touches:this.getCurrentStore().getPositions()},i.getPosition(),{inputEvent:t}))}},n.onPinch=function(t,n){if(this.flag&&this.pinchFlag&&!(n.length<2)){var i=this.getCurrentStore();this.isPinch=!0,this.trigger("pinch",m({datas:this.datas,movement:this.getMovement(n),angle:i.getAngle(n),rotation:i.getRotation(n),touches:i.getPositions(n),scale:i.getScale(n),distance:i.getDistance(n)},i.getPosition(n),{inputEvent:t}))}},n.onPinchEnd=function(t){if(this.pinchFlag){var n=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var i=this.getCurrentStore();this.trigger("pinchEnd",m({datas:this.datas,isPinch:n,touches:i.getPositions()},i.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},n.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.flag=!1},n.getCurrentStore=function(){return this.clientStores[0]},n.moveClients=function(t,n,i){var e=this.getCurrentStore()[i?"addClients":"getPosition"](t);return this.isDrag=!0,m({datas:this.datas},e,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:n})},t}(t),c={default:n};for(var h in c)n[h]=c[h];return n});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Gesto=n()}(this,function(){"use strict";var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])})(t,n)};var m=function(){return(m=Object.assign||function(t){for(var n,i=1,e=arguments.length;i<e;i++)for(var r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}).apply(this,arguments)};function i(t){return function(t,n){var i=n[0]-t[0],e=n[1]-t[1],r=Math.atan2(e,i);return 0<=r?r:r+2*Math.PI}([t[0].clientX,t[0].clientY],[t[1].clientX,t[1].clientY])/Math.PI*180}function D(t){return t.touches?function(t){for(var n=Math.min(t.length,2),i=[],e=0;e<n;++e)i.push(s(t[e]));return i}(t.touches):[s(t)]}function r(t,n,i){var e=i.length,r=f(t,e),o=r.clientX,s=r.clientY,a=r.originalClientX,c=r.originalClientY,h=f(n,e),l=h.clientX,u=h.clientY,g=f(i,e);return{clientX:a,clientY:c,deltaX:o-l,deltaY:s-u,distX:o-g.clientX,distY:s-g.clientY}}function o(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function s(t){return{clientX:t.clientX,clientY:t.clientY}}function f(t,n){void 0===n&&(n=t.length);for(var i={clientX:0,clientY:0,originalClientX:0,originalClientY:0},e=0;e<n;++e){var r=t[e];i.originalClientX+="originalClientX"in r?r.originalClientX:r.clientX,i.originalClientY+="originalClientY"in r?r.originalClientY:r.clientY,i.clientX+=r.clientX,i.clientY+=r.clientY}return n?{clientX:i.clientX/n,clientY:i.clientY/n,originalClientX:i.originalClientX/n,originalClientY:i.originalClientY/n}:i}function a(t){return void 0===t}var t=function(){var t=function(){function t(){this._eventHandler={},this.options={}}var n=t.prototype;return n.trigger=function(t,n){void 0===n&&(n={});var i=this._eventHandler[t]||[];if(!(0<i.length))return!0;i=i.concat(),n.eventType=t;var e=!1,r=[n],o=0;n.stop=function(){e=!0},n.currentTarget=this;for(var s=arguments.length,a=new Array(2<s?s-2:0),c=2;c<s;c++)a[c-2]=arguments[c];for(1<=a.length&&(r=r.concat(a)),o=0;i[o];o++)i[o].apply(this,r);return!e},n.once=function(r,o){if("object"==typeof r&&a(o)){var t,n=r;for(t in n)this.once(t,n[t]);return this}if("string"==typeof r&&"function"==typeof o){var s=this;this.on(r,function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];o.apply(s,i),s.off(r,t)})}return this},n.hasOn=function(t){return!!this._eventHandler[t]},n.on=function(t,n){if("object"==typeof t&&a(n)){var i,e=t;for(i in e)this.on(i,e[i]);return this}if("string"==typeof t&&"function"==typeof n){var r=this._eventHandler[t];a(r)&&(this._eventHandler[t]=[],r=this._eventHandler[t]),r.push(n)}return this},n.off=function(t,n){if(a(t))return this._eventHandler={},this;if(a(n)){if("string"==typeof t)return this._eventHandler[t]=void 0,this;var i,e=t;for(i in e)this.off(i,e[i]);return this}var r,o,s=this._eventHandler[t];if(s)for(r=0;void 0!==(o=s[r]);r++)if(o===n){s=s.splice(r,1);break}return this},t}();return t.VERSION="2.1.2",t}();function S(){return Date.now?Date.now():(new Date).getTime()}function P(t,n,i,e){t.addEventListener(n,i,e)}function X(t,n,i){t.removeEventListener(n,i)}var Y=function(){function t(t){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=t,this.prevClients=t,this.length=t.length}var n=t.prototype;return n.addClients=function(t){void 0===t&&(t=this.prevClients);var n=this.getPosition(t),i=n.deltaX,e=n.deltaY;return this.movement+=Math.sqrt(i*i+e*e),this.prevClients=t,n},n.getAngle=function(t){return void 0===t&&(t=this.prevClients),i(t)},n.getRotation=function(t){return void 0===t&&(t=this.prevClients),i(t)-i(this.startClients)},n.getPosition=function(t){return r(t||this.prevClients,this.prevClients,this.startClients)},n.getPositions=function(i){void 0===i&&(i=this.prevClients);var e=this.prevClients;return this.startClients.map(function(t,n){return r([i[n]],[e[n]],[t])})},n.getMovement=function(t){var n=this.movement;if(!t)return n;var i=f(t,this.length),e=f(this.prevClients,this.length),r=i.clientX-e.clientX,o=i.clientY-e.clientY;return Math.sqrt(r*r+o*o)+n},n.getDistance=function(t){return void 0===t&&(t=this.prevClients),o(t)},n.getScale=function(t){return void 0===t&&(t=this.prevClients),o(t)/o(this.startClients)},n.move=function(n,i){this.startClients.forEach(function(t){t.clientX-=n,t.clientY-=i}),this.prevClients.forEach(function(t){t.clientX-=n,t.clientY-=i})},t}(),E=["textarea","input"],n=function(a){function t(t,n){void 0===n&&(n={});var C=a.call(this)||this;C.options={},C.flag=!1,C.pinchFlag=!1,C.datas={},C.isDrag=!1,C.isPinch=!1,C.isMouse=!1,C.isTouch=!1,C.clientStores=[],C.targets=[],C.prevTime=0,C.isDouble=!1,C.onDragStart=function(t,n){if(void 0===n&&(n=!0),C.flag||!1!==t.cancelable){var i=C.options,e=i.container,r=i.pinchOutside,o=i.preventRightClick,s=i.preventDefault,a=i.checkInput,c=C.isTouch,h=!C.flag;if(h){var l=document.activeElement,u=t.target,g=u.tagName.toLowerCase(),f=-1<E.indexOf(g),v=u.isContentEditable;if(f||v){if(a||l===u)return!1;if(l&&v&&l.isContentEditable&&l.contains(u))return!1}else if((s||"touchstart"===t.type)&&l){var p=l.tagName;(l.isContentEditable||-1<E.indexOf(p))&&l.blur()}if(C.clientStores=[new Y(D(t))],C.flag=!0,C.isDrag=!1,C.datas={},o&&(3===t.which||2===t.button))return C.initDrag(),!1;!1===C.trigger("dragStart",m({datas:C.datas,inputEvent:t,isTrusted:n},C.getCurrentStore().getPosition()))&&C.initDrag(),C.isDouble=S()-C.prevTime<200,C.flag&&s&&t.preventDefault()}if(!C.flag)return!1;var d=0;if(h&&c&&r&&(d=setTimeout(function(){P(e,"touchstart",C.onDragStart,{passive:!1})})),!h&&c&&r&&X(e,"touchstart",C.onDragStart),C.flag&&function(t){return t.touches&&2<=t.touches.length}(t)){if(clearTimeout(d),h&&t.touches.length!==t.changedTouches.length)return;C.pinchFlag||C.onPinchStart(t)}}},C.onDrag=function(t,n){if(C.flag){var i=D(t),e=C.moveClients(i,t,!1);(C.pinchFlag||e.deltaX||e.deltaY)&&C.trigger("drag",m({},e,{isScroll:!!n,inputEvent:t})),C.pinchFlag&&C.onPinch(t,i),C.getCurrentStore().addClients(i)}},C.onDragEnd=function(t){if(C.flag){var n=C.options,i=n.pinchOutside,e=n.container;C.isTouch&&i&&X(e,"touchstart",C.onDragStart),C.flag=!1;var r=C.getCurrentStore().getPosition(),o=S(),s=!C.isDrag&&C.isDouble;C.prevTime=C.isDrag||s?0:o,C.trigger("dragEnd",m({datas:C.datas,isDouble:s,isDrag:C.isDrag,inputEvent:t},r)),C.pinchFlag&&C.onPinchEnd(t),C.clientStores=[]}};var i=[].concat(t);C.options=m({checkInput:!1,container:1<i.length?window:i[0],preventRightClick:!0,preventDefault:!0,pinchThreshold:0,events:["touch","mouse"]},n);var e=C.options,r=e.container,o=e.events;if(C.isTouch=-1<o.indexOf("touch"),C.isMouse=-1<o.indexOf("mouse"),C.targets=i,C.isMouse&&(i.forEach(function(t){P(t,"mousedown",C.onDragStart)}),P(r,"mousemove",C.onDrag),P(r,"mouseup",C.onDragEnd),P(r,"contextmenu",C.onDragEnd)),C.isTouch){var s={passive:!1};i.forEach(function(t){P(t,"touchstart",C.onDragStart,s)}),P(r,"touchmove",C.onDrag,s),P(r,"touchend",C.onDragEnd,s),P(r,"touchcancel",C.onDragEnd,s)}return C}!function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}(t,a);var n=t.prototype;return n.getMovement=function(t){return this.getCurrentStore().getMovement(t)+this.clientStores.slice(1).reduce(function(t,n){return t+n.movement},0)},n.isDragging=function(){return this.isDrag},n.isFlag=function(){return this.flag},n.isPinchFlag=function(){return this.pinchFlag},n.isPinching=function(){return this.isPinch},n.scrollBy=function(t,n,i,e){void 0===e&&(e=!0),this.flag&&(this.clientStores[0].move(t,n),e&&this.onDrag(i,!0))},n.move=function(t,n){var e=t[0],r=t[1],i=this.getCurrentStore().prevClients;return this.moveClients(i.map(function(t){var n=t.clientX,i=t.clientY;return{clientX:n+e,clientY:i+r,originalClientX:n,originalClientY:i}}),n,!0)},n.triggerDragStart=function(t){this.onDragStart(t,!1)},n.unset=function(){var n=this,t=this.targets,i=this.options.container;this.off(),this.isMouse&&(t.forEach(function(t){X(t,"mousedown",n.onDragStart)}),X(i,"mousemove",this.onDrag),X(i,"mouseup",this.onDragEnd),X(i,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){X(t,"touchstart",n.onDragStart)}),X(i,"touchstart",this.onDragStart),X(i,"touchmove",this.onDrag),X(i,"touchend",this.onDragEnd),X(i,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var n=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>n)){var i=new Y(D(t));this.pinchFlag=!0,this.clientStores.splice(0,0,i),!1===this.trigger("pinchStart",m({datas:this.datas,angle:i.getAngle(),touches:this.getCurrentStore().getPositions()},i.getPosition(),{inputEvent:t}))&&(this.pinchFlag=!1)}},n.onPinch=function(t,n){if(this.flag&&this.pinchFlag&&!(n.length<2)){var i=this.getCurrentStore();this.isPinch=!0,this.trigger("pinch",m({datas:this.datas,movement:this.getMovement(n),angle:i.getAngle(n),rotation:i.getRotation(n),touches:i.getPositions(n),scale:i.getScale(n),distance:i.getDistance(n)},i.getPosition(n),{inputEvent:t}))}},n.onPinchEnd=function(t){if(this.pinchFlag){var n=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var i=this.getCurrentStore();this.trigger("pinchEnd",m({datas:this.datas,isPinch:n,touches:i.getPositions()},i.getPosition(),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}},n.initDrag=function(){this.clientStores=[],this.pinchFlag=!1,this.flag=!1},n.getCurrentStore=function(){return this.clientStores[0]},n.moveClients=function(t,n,i){var e=this.getCurrentStore()[i?"addClients":"getPosition"](t);return this.isDrag=!0,m({datas:this.datas},e,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:n})},t}(t),c={default:n};for(var h in c)n[h]=c[h];return n});
//# sourceMappingURL=gesto.min.js.map
{
"name": "gesto",
"version": "1.0.0",
"version": "1.0.1",
"description": "You can set up drag, pinch events in any browser.",

@@ -5,0 +5,0 @@ "main": "./dist/gesto.cjs.js",

@@ -299,3 +299,3 @@ import { Client, OnDrag, GestoOptions, GestoEvents, ComponentTriggerType } from "./types";

this.trigger("pinchStart", {
const result = this.trigger("pinchStart", {
datas: this.datas,

@@ -307,2 +307,6 @@ angle: store.getAngle(),

});
if (result === false) {
this.pinchFlag = false;
}
}

@@ -309,0 +313,0 @@ public onPinch(e: TouchEvent, clients: Client[]) {

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

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