From 8697d77978b5aa830ca2568455e8a39d16457fb7 Mon Sep 17 00:00:00 2001 From: Mike Schultz Date: Wed, 6 Jul 2016 15:44:49 -0700 Subject: [PATCH] Exposed production file, updated build include instructions, and added license --- .gitignore | 1 - LICENSE | 21 +++++++++++++++++++++ dist/zingtouch.min.js | 1 + index.js | 2 ++ package.json | 2 +- readme.md | 14 +++++++++++--- src/core/main.js | 2 -- 7 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 LICENSE create mode 100644 dist/zingtouch.min.js create mode 100644 index.js diff --git a/.gitignore b/.gitignore index 13fa8e1..6b8a1f6 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,5 @@ node_modules/ ._* bower_components/ .idea/ -dist/ playground/ docs/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..471dd6f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 ZingChart + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/dist/zingtouch.min.js b/dist/zingtouch.min.js new file mode 100644 index 0000000..6a66407 --- /dev/null +++ b/dist/zingtouch.min.js @@ -0,0 +1 @@ +!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(1),u=r(i);window.ZingTouch=u["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2),u=r(i),o=n(5),a=r(o),s=n(13),c=r(s),f=n(15),l=r(f),d=n(16),p=r(d),h=n(17),y=r(h),v=n(18),g=r(v),m=n(19),b=r(m),w={_regions:[],Gesture:a["default"],Expand:c["default"],Pan:l["default"],Pinch:p["default"],Rotate:y["default"],Swipe:g["default"],Tap:b["default"],Region:function(e,t,n){var r=w._regions.length,i=new u["default"](e,t,n,r);return w._regions.push(i),i}};t["default"]=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n0){t.preventDefault?(l["default"].setMSPreventDefault(t.element),e.preventDefault?e.preventDefault():e.returnValue=!1):l["default"].removeMSPreventDefault(t.element);var i={},u=(0,c["default"])(r,e,n);u.forEach(function(t){var n=t.binding.gesture.id;if(i[n]){var r=l["default"].getPropagationPath(e);l["default"].getPathIndex(r,t.binding.element)r?u*(n-i):u*i},getVelocity:function(e,t,n,r,i,u){var o=this.distanceBetweenTwoPoints(e,r,t,i);return o/(u-n)},getRightMostInput:function(e){var t=null,n=Number.MIN_VALUE;return e.forEach(function(e){e.initial.x>n&&(t=e)}),t},isInteger:function(e){return"number"==typeof e&&e%1===0},isInside:function(e,t,n){var r=n.getBoundingClientRect();return e>r.left&&er.top&&t0&&t.push(n)}),t}},{key:"updateInputs",value:function(e,t){function n(e,t,n,r){var i=I["default"].normalizeEvent(e.type),o=u(t.inputs,n);return"start"===i&&o?void t.resetInputs():"start"!==i&&o&&!I["default"].isInside(o.current.x,o.current.y,r)?void t.resetInputs():"start"===i||o?void("start"===i?t.inputs.push(new x["default"](e,n)):o.update(e,n)):void t.resetInputs()}var r=T,i=e.touches?"TouchEvent":e.pointerType?"PointerEvent":"MouseEvent";switch(i){case"TouchEvent":if(e.touches.length!==e.targetTouches.length)return!1;for(var o in e.changedTouches)e.changedTouches.hasOwnProperty(o)&&I["default"].isInteger(parseInt(o))&&(r=e.changedTouches[o].identifier,n(e,this,r,t));break;case"PointerEvent":r=e.pointerId,n(e,this,r,t);break;case"MouseEvent":default:n(e,this,T,t)}return!0}},{key:"resetInputs",value:function(){this.inputs=[]}},{key:"numActiveInputs",value:function(){var e=this.inputs.filter(function(e){return"end"!==e.current.type});return e.length}},{key:"registerGesture",value:function(e,t){this.assignGestureId(e),this.registeredGestures[t]=e}},{key:"assignGestureId",value:function(e){e.setId(this.regionId+"-"+this.numGestures++)}}]),e}();t["default"]=k},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(14),s=r(a),c=n(10),f=(r(c),function(e){function t(e){i(this,t);var n=u(this,Object.getPrototypeOf(t).call(this,e));return n.type="expand",n}return o(t,e),t}(s["default"]));t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n=this.threshold)return i.lastEmittedDistance=n,{distance:n}}else if(n>r)i.lastEmittedDistance=n;else if(n=this.threshold)return i.lastEmittedDistance=n,{distance:n};return null}}}]),t}(c["default"]);t["default"]=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;nthis.threshold||Math.abs(e[r].current.x-i.lastEmitted.x)>this.threshold,!i.active||!u)return null;n.data[r]={distanceFromOrigin:l["default"].distanceBetweenTwoPoints(e[r].initial.x,e[r].current.x,e[r].initial.y,e[r].current.y),directionFromOrigin:l["default"].getAngle(e[r].initial.x,e[r].initial.y,e[r].current.x,e[r].current.y),currentDirection:l["default"].getAngle(i.lastEmitted.x,i.lastEmitted.y,e[r].current.x,e[r].current.y)},i.lastEmitted.x=e[r].current.x,i.lastEmitted.y=e[r].current.y}return n}},{key:"end",value:function(e){var t=this;return e.forEach(function(e){var n=e.getGestureProgress(t.getId());n.active=!1}),null}}]),t}(c["default"]);t["default"]=h},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=n(14),s=r(a),c=n(10),f=(r(c),function(e){function t(e){i(this,t);var n=u(this,Object.getPrototypeOf(t).call(this,e));return n.type="pinch",n}return o(t,e),t}(s["default"]));t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;nthis.maxProgressStack&&r.moves.shift()}return null}},{key:"end",value:function(e){if(this.numInputs===e.length){for(var t={data:[]},n=0;n2){var i=r.moves.pop();if((new Date).getTime()-i.time>this.maxRestTime)return null;for(var u,o=r.moves.length-1;o!==-1;){if(r.moves[o].time!==i.time){u=r.moves[o];break}o--}u||(u=r.moves.pop(),u.time+=this.timeDistortion);var a=l["default"].getVelocity(u.x,u.y,u.time,i.x,i.y,i.time);t.data[n]={velocity:a,currentDirection:l["default"].getAngle(u.x,u.y,i.x,i.y)}}}for(var n=0;n0)return t}return null}}]),t}(c["default"]);t["default"]=g},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s=function(){function e(e,t){for(var n=0;n=u)return{interval:u};var o=function(){var n=t.type;return e.forEach(function(e){e.resetProgress(n)}),{v:null}}();return"object"===("undefined"==typeof o?"undefined":a(o))?o.v:void 0}}]),t}(f["default"]);t["default"]=g}]); \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..f4d9b77 --- /dev/null +++ b/index.js @@ -0,0 +1,2 @@ +require('./dist/zingtouch.min.js'); +module.exports = ZingTouch; diff --git a/package.json b/package.json index 0803068..9a71b4e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "zingtouch", "version": "1.0.0", "description": "A modern JavaScript touch gesture library", - "main": "dist/zingtouch.min.js", + "main": "index.js", "directories": { "test": "test" }, diff --git a/readme.md b/readme.md index c3d66d8..6d0d7e0 100644 --- a/readme.md +++ b/readme.md @@ -42,10 +42,10 @@ ZingTouch is also has lifecycle events that you can hook into to create new Gest ### Include the library -***ES6 / CommonJS*** +***Node / CommonJS*** ``` -var ZingTouch = require('ZingTouch'); +var ZingTouch = require('zingtouch'); ``` or @@ -53,7 +53,15 @@ or ***Include the file*** ``` - + +``` + +or + +***ES6*** + +``` + ``` diff --git a/src/core/main.js b/src/core/main.js index bdcb3e4..fcd9a88 100644 --- a/src/core/main.js +++ b/src/core/main.js @@ -5,5 +5,3 @@ import ZingTouch from './../ZingTouch.js'; window.ZingTouch = ZingTouch; -export {ZingTouch}; -