sirius/vendor/grapesjs/touch.js

3 lines
16 KiB
JavaScript
Raw Normal View History

/*! grapesjs-touch - 0.1.1 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["grapesjs-touch"]=t():e["grapesjs-touch"]=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(1)),i=r(n(2));function r(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){(0,i.default)(),(0,o.default)()}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e;!function(e){var t=function(){function e(){this._dropEffect="move",this._effectAllowed="all",this._data={}}return Object.defineProperty(e.prototype,"dropEffect",{get:function(){return this._dropEffect},set:function(e){this._dropEffect=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"effectAllowed",{get:function(){return this._effectAllowed},set:function(e){this._effectAllowed=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){return Object.keys(this._data)},enumerable:!0,configurable:!0}),e.prototype.clearData=function(e){null!=e?delete this._data[e]:this._data=null},e.prototype.getData=function(e){return this._data[e]||""},e.prototype.setData=function(e,t){this._data[e]=t},e.prototype.setDragImage=function(e,t,o){var i=n._instance;i._imgCustom=e,i._imgOffset={x:t,y:o}},e}();e.DataTransfer=t;var n=function(){function e(){if(this._lastClick=0,e._instance)throw"DragDropTouch instance already created.";var t=!1;if(document.addEventListener("test",function(){},{get passive(){return t=!0,!0}}),"ontouchstart"in document){var n=document,o=this._touchstart.bind(this),i=this._touchmove.bind(this),r=this._touchend.bind(this),s=!!t&&{passive:!1,capture:!1};n.addEventListener("touchstart",o,s),n.addEventListener("touchmove",i,s),n.addEventListener("touchend",r),n.addEventListener("touchcancel",r)}}return e.getInstance=function(){return e._instance},e.prototype._touchstart=function(t){var n=this;if(this._shouldHandle(t)){if(Date.now()-this._lastClick<e._DBLCLICK&&this._dispatchEvent(t,"dblclick",t.target))return t.preventDefault(),void this._reset();this._reset();var o=this._closestDraggable(t.target);o&&(this._dispatchEvent(t,"mousemove",t.target)||this._dispatchEvent(t,"mousedown",t.target)||(this._dragSource=o,this._ptDown=this._getPoint(t),this._lastTouch=t,t.preventDefault(),setTimeout(function(){n._dragSource==o&&null==n._img&&n._dispatchEvent(t,"contextmenu",o)&&n._reset()},e._CTXMENU)))}},e.prototype._touchmove=function(t){if(this._shouldHandle(t)){var n=this._getTarget(t);if(this._dragSource&&!this._img)this._getDelta(t)>e._THRESHOLD&&(this._dispatchEvent(t,"dragstart",this._dragSource),this._createImage(t),this._dispatchEvent(t,"dragenter",n));if(this._img&&(this._lastTouch=t,t.preventDefault(),n!=this._lastTarget&&(this._dispatchEvent(this._lastTouch,"dragleave",this._lastTarget),this._dispatchEvent(t,"dragenter",n),this._lastTarget=n),this._moveImage(t),this._dispatchEvent(t,"dragover",n)),this._dispatchEvent(t,"mousemove",n))return this._lastTouch=t,void t.preventDefault()}},e.prototype._touchend=function(e){if(thi
//# sourceMappingURL=grapesjs-touch.min.js.map