Comparing version 1.1.0 to 1.1.1
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/gesture.git | ||
version: 1.1.0 | ||
version: 1.1.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ 'use strict'; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/gesture.git | ||
version: 1.1.0 | ||
version: 1.1.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ import EventEmitter from '@scena/event-emitter'; |
@@ -7,3 +7,3 @@ /* | ||
repository: git+https://github.com/daybrush/gesture.git | ||
version: 1.1.0 | ||
version: 1.1.1 | ||
*/ | ||
@@ -286,3 +286,3 @@ (function (global, factory) { | ||
repository: git+https://github.com/daybrush/gesture.git | ||
version: 1.0.0 | ||
version: 1.0.2 | ||
*/ | ||
@@ -497,3 +497,3 @@ | ||
return isStop; | ||
return !isStop; | ||
}; | ||
@@ -500,0 +500,0 @@ /** |
@@ -7,5 +7,5 @@ /* | ||
repository: git+https://github.com/daybrush/gesture.git | ||
version: 1.1.0 | ||
version: 1.1.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 C=function(){return(C=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,u=f(n,e),l=u.clientX,h=u.clientY,g=f(i,e);return{clientX:a,clientY:c,deltaX:o-l,deltaY:s-h,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 t&&"object"==typeof t}function E(){return Date.now?Date.now():(new Date).getTime()}function S(t,n,i,e){t.addEventListener(n,i,e)}function P(t,n,i){t.removeEventListener(n,i)}var c=function(){return(c=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)};var t=function(){function t(){this._events={}}var n=t.prototype;return n.on=function(t,n){if(a(t))for(var i in t)this.on(i,t[i]);else this._addEvent(t,n,{});return this},n.off=function(t,n){if(t)if(a(t))for(var i in t)this.off(i);else if(n){var e=this._events[t];if(e){var r=function(t,n,i){void 0===i&&(i=-1);for(var e=t.length,r=0;r<e;++r)if(n(t[r],r,t))return r;return i}(e,function(t){return t.listener===n});-1<r&&e.splice(r,1)}}else this._events[t]=[];else this._events={};return this},n.once=function(n,t){var i=this;return t&&this._addEvent(n,t,{once:!0}),new Promise(function(t){i._addEvent(n,t,{once:!0})})},n.emit=function(n,i){var e=this;void 0===i&&(i={});var t=this._events[n];if(!n||!t)return!0;var r=!1;return i.eventType=n,i.stop=function(){r=!0},i.currentTarget=this,function(){for(var t=0,n=0,i=arguments.length;n<i;n++)t+=arguments[n].length;var e=Array(t),r=0;for(n=0;n<i;n++)for(var o=arguments[n],s=0,a=o.length;s<a;s++,r++)e[r]=o[s];return e}(t).forEach(function(t){t.listener(i),t.once&&e.off(n,t.listener)}),r},n.trigger=function(t,n){return void 0===n&&(n={}),this.emit(t,n)},n._addEvent=function(t,n,i){var e=this._events;e[t]=e[t]||[],e[t].push(c({listener:n},i))},t}(),X=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}(),Y=["textarea","input"],n=function(c){function t(t,n){void 0===n&&(n={});var m=c.call(this)||this;m.options={},m.flag=!1,m.pinchFlag=!1,m.datas={},m.isDrag=!1,m.isPinch=!1,m.isMouse=!1,m.isTouch=!1,m.clientStores=[],m.targets=[],m.prevTime=0,m.isDouble=!1,m.onDragStart=function(t,n){if(void 0===n&&(n=!0),m.flag||!1!==t.cancelable){var i=m.options,e=i.container,r=i.pinchOutside,o=i.preventRightClick,s=i.preventDefault,a=i.checkInput,c=m.isTouch,u=!m.flag;if(u){var l=document.activeElement,h=t.target,g=h.tagName.toLowerCase(),f=-1<Y.indexOf(g),v=h.isContentEditable;if(f||v){if(a||l===h)return!1;if(l&&v&&l.isContentEditable&&l.contains(h))return!1}else if((s||"touchstart"===t.type)&&l){var p=l.tagName;(l.isContentEditable||-1<Y.indexOf(p))&&l.blur()}if(m.clientStores=[new X(D(t))],m.flag=!0,m.isDrag=!1,m.datas={},o&&(3===t.which||2===t.button))return m.initDrag(),!1;!1===m.emit("dragStart",C({datas:m.datas,inputEvent:t,isTrusted:n},m.getCurrentStore().getPosition()))&&m.initDrag(),m.isDouble=E()-m.prevTime<200,m.flag&&s&&t.preventDefault()}if(!m.flag)return!1;var d=0;if(u&&c&&r&&(d=setTimeout(function(){S(e,"touchstart",m.onDragStart,{passive:!1})})),!u&&c&&r&&P(e,"touchstart",m.onDragStart),m.flag&&function(t){return t.touches&&2<=t.touches.length}(t)){if(clearTimeout(d),u&&t.touches.length!==t.changedTouches.length)return;m.pinchFlag||m.onPinchStart(t)}}},m.onDrag=function(t,n){if(m.flag){var i=D(t),e=m.moveClients(i,t,!1);(m.pinchFlag||e.deltaX||e.deltaY)&&m.emit("drag",C({},e,{isScroll:!!n,inputEvent:t})),m.pinchFlag&&m.onPinch(t,i),m.getCurrentStore().addClients(i)}},m.onDragEnd=function(t){if(m.flag){var n=m.options,i=n.pinchOutside,e=n.container;m.isTouch&&i&&P(e,"touchstart",m.onDragStart),m.flag=!1;var r=m.getCurrentStore().getPosition(),o=E(),s=!m.isDrag&&m.isDouble;m.prevTime=m.isDrag||s?0:o,m.emit("dragEnd",C({datas:m.datas,isDouble:s,isDrag:m.isDrag,inputEvent:t},r)),m.pinchFlag&&m.onPinchEnd(t),m.clientStores=[]}},m.onBlur=function(){m.onDragEnd()};var i=[].concat(t);m.options=C({checkInput:!1,container:1<i.length?window:i[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},n);var e=m.options,r=e.container,o=e.events,s=e.checkWindowBlur;if(m.isTouch=-1<o.indexOf("touch"),m.isMouse=-1<o.indexOf("mouse"),m.targets=i,m.isMouse&&(i.forEach(function(t){S(t,"mousedown",m.onDragStart)}),S(r,"mousemove",m.onDrag),S(r,"mouseup",m.onDragEnd),S(r,"contextmenu",m.onDragEnd)),s&&S(window,"blur",m.onBlur),m.isTouch){var a={passive:!1};i.forEach(function(t){S(t,"touchstart",m.onDragStart,a)}),S(r,"touchmove",m.onDrag,a),S(r,"touchend",m.onDragEnd,a),S(r,"touchcancel",m.onDragEnd,a)}return m}!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,c);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(),P(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){P(t,"mousedown",n.onDragStart)}),P(i,"mousemove",this.onDrag),P(i,"mouseup",this.onDragEnd),P(i,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){P(t,"touchstart",n.onDragStart)}),P(i,"touchstart",this.onDragStart),P(i,"touchmove",this.onDrag),P(i,"touchend",this.onDragEnd),P(i,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var n=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>n)){var i=new X(D(t));this.pinchFlag=!0,this.clientStores.splice(0,0,i),!1===this.emit("pinchStart",C({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.emit("pinch",C({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.emit("pinchEnd",C({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,C({datas:this.datas},e,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:n})},t}(t),u={default:n};for(var l in u)n[l]=u[l];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 C=function(){return(C=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,u=f(n,e),l=u.clientX,h=u.clientY,g=f(i,e);return{clientX:a,clientY:c,deltaX:o-l,deltaY:s-h,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 t&&"object"==typeof t}function E(){return Date.now?Date.now():(new Date).getTime()}function S(t,n,i,e){t.addEventListener(n,i,e)}function P(t,n,i){t.removeEventListener(n,i)}var c=function(){return(c=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)};var t=function(){function t(){this._events={}}var n=t.prototype;return n.on=function(t,n){if(a(t))for(var i in t)this.on(i,t[i]);else this._addEvent(t,n,{});return this},n.off=function(t,n){if(t)if(a(t))for(var i in t)this.off(i);else if(n){var e=this._events[t];if(e){var r=function(t,n,i){void 0===i&&(i=-1);for(var e=t.length,r=0;r<e;++r)if(n(t[r],r,t))return r;return i}(e,function(t){return t.listener===n});-1<r&&e.splice(r,1)}}else this._events[t]=[];else this._events={};return this},n.once=function(n,t){var i=this;return t&&this._addEvent(n,t,{once:!0}),new Promise(function(t){i._addEvent(n,t,{once:!0})})},n.emit=function(n,i){var e=this;void 0===i&&(i={});var t=this._events[n];if(!n||!t)return!0;var r=!1;return i.eventType=n,i.stop=function(){r=!0},i.currentTarget=this,function(){for(var t=0,n=0,i=arguments.length;n<i;n++)t+=arguments[n].length;var e=Array(t),r=0;for(n=0;n<i;n++)for(var o=arguments[n],s=0,a=o.length;s<a;s++,r++)e[r]=o[s];return e}(t).forEach(function(t){t.listener(i),t.once&&e.off(n,t.listener)}),!r},n.trigger=function(t,n){return void 0===n&&(n={}),this.emit(t,n)},n._addEvent=function(t,n,i){var e=this._events;e[t]=e[t]||[],e[t].push(c({listener:n},i))},t}(),X=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}(),Y=["textarea","input"],n=function(c){function t(t,n){void 0===n&&(n={});var m=c.call(this)||this;m.options={},m.flag=!1,m.pinchFlag=!1,m.datas={},m.isDrag=!1,m.isPinch=!1,m.isMouse=!1,m.isTouch=!1,m.clientStores=[],m.targets=[],m.prevTime=0,m.isDouble=!1,m.onDragStart=function(t,n){if(void 0===n&&(n=!0),m.flag||!1!==t.cancelable){var i=m.options,e=i.container,r=i.pinchOutside,o=i.preventRightClick,s=i.preventDefault,a=i.checkInput,c=m.isTouch,u=!m.flag;if(u){var l=document.activeElement,h=t.target,g=h.tagName.toLowerCase(),f=-1<Y.indexOf(g),v=h.isContentEditable;if(f||v){if(a||l===h)return!1;if(l&&v&&l.isContentEditable&&l.contains(h))return!1}else if((s||"touchstart"===t.type)&&l){var p=l.tagName;(l.isContentEditable||-1<Y.indexOf(p))&&l.blur()}if(m.clientStores=[new X(D(t))],m.flag=!0,m.isDrag=!1,m.datas={},o&&(3===t.which||2===t.button))return m.initDrag(),!1;!1===m.emit("dragStart",C({datas:m.datas,inputEvent:t,isTrusted:n},m.getCurrentStore().getPosition()))&&m.initDrag(),m.isDouble=E()-m.prevTime<200,m.flag&&s&&t.preventDefault()}if(!m.flag)return!1;var d=0;if(u&&c&&r&&(d=setTimeout(function(){S(e,"touchstart",m.onDragStart,{passive:!1})})),!u&&c&&r&&P(e,"touchstart",m.onDragStart),m.flag&&function(t){return t.touches&&2<=t.touches.length}(t)){if(clearTimeout(d),u&&t.touches.length!==t.changedTouches.length)return;m.pinchFlag||m.onPinchStart(t)}}},m.onDrag=function(t,n){if(m.flag){var i=D(t),e=m.moveClients(i,t,!1);(m.pinchFlag||e.deltaX||e.deltaY)&&m.emit("drag",C({},e,{isScroll:!!n,inputEvent:t})),m.pinchFlag&&m.onPinch(t,i),m.getCurrentStore().addClients(i)}},m.onDragEnd=function(t){if(m.flag){var n=m.options,i=n.pinchOutside,e=n.container;m.isTouch&&i&&P(e,"touchstart",m.onDragStart),m.flag=!1;var r=m.getCurrentStore().getPosition(),o=E(),s=!m.isDrag&&m.isDouble;m.prevTime=m.isDrag||s?0:o,m.emit("dragEnd",C({datas:m.datas,isDouble:s,isDrag:m.isDrag,inputEvent:t},r)),m.pinchFlag&&m.onPinchEnd(t),m.clientStores=[]}},m.onBlur=function(){m.onDragEnd()};var i=[].concat(t);m.options=C({checkInput:!1,container:1<i.length?window:i[0],preventRightClick:!0,preventDefault:!0,checkWindowBlur:!1,pinchThreshold:0,events:["touch","mouse"]},n);var e=m.options,r=e.container,o=e.events,s=e.checkWindowBlur;if(m.isTouch=-1<o.indexOf("touch"),m.isMouse=-1<o.indexOf("mouse"),m.targets=i,m.isMouse&&(i.forEach(function(t){S(t,"mousedown",m.onDragStart)}),S(r,"mousemove",m.onDrag),S(r,"mouseup",m.onDragEnd),S(r,"contextmenu",m.onDragEnd)),s&&S(window,"blur",m.onBlur),m.isTouch){var a={passive:!1};i.forEach(function(t){S(t,"touchstart",m.onDragStart,a)}),S(r,"touchmove",m.onDrag,a),S(r,"touchend",m.onDragEnd,a),S(r,"touchcancel",m.onDragEnd,a)}return m}!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,c);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(),P(window,"blur",this.onBlur),this.isMouse&&(t.forEach(function(t){P(t,"mousedown",n.onDragStart)}),P(i,"mousemove",this.onDrag),P(i,"mouseup",this.onDragEnd),P(i,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach(function(t){P(t,"touchstart",n.onDragStart)}),P(i,"touchstart",this.onDragStart),P(i,"touchmove",this.onDrag),P(i,"touchend",this.onDragEnd),P(i,"touchcancel",this.onDragEnd))},n.onPinchStart=function(t){var n=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>n)){var i=new X(D(t));this.pinchFlag=!0,this.clientStores.splice(0,0,i),!1===this.emit("pinchStart",C({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.emit("pinch",C({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.emit("pinchEnd",C({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,C({datas:this.datas},e,{movement:this.getMovement(t),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:n})},t}(t),u={default:n};for(var l in u)n[l]=u[l];return n}); | ||
//# sourceMappingURL=gesto.min.js.map |
{ | ||
"name": "gesto", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "You can set up drag, pinch events in any browser.", | ||
@@ -50,4 +50,4 @@ "main": "./dist/gesto.cjs.js", | ||
"@daybrush/utils": "^1.0.0", | ||
"@scena/event-emitter": "^1.0.0" | ||
"@scena/event-emitter": "^1.0.2" | ||
} | ||
} |
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
249540
Updated@scena/event-emitter@^1.0.2