提交 49908136 authored 作者: 钟是志's avatar 钟是志

公共代码库中增加 photoClip 的js 代码

上级 66bbcd8f
......@@ -24,3 +24,13 @@ export default async function importDependence() {
}
return new Promise((resolve, reject) => resolve(false));
}
// export function importPhotoClip() {
// const path = require('path').resolve(__dirname, '');
// const path1 = window.location.origin + path + '/photoClip/iscroll-zoom-min.js';
// const path2 = window.location.origin + path + '/photoClip/hammer.min.js';
// const path3 = window.location.origin + path + '/photoClip/lrz.all.bundle.js';
// const path4 = window.location.origin + path + '/photoClip/PhotoClip.js';
// const a = require('./js/iscroll-zoom-min.js');
// console.log(a);
// }
/*!
* PhotoClip - 一款手势驱动的裁图插件
* @version v3.4.8
* @author baijunjie
* @license MIT
*
* git - https://github.com/baijunjie/PhotoClip.js.git
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("hammerjs"), require("iscroll/build/iscroll-zoom"), require("lrz"));
else if(typeof define === 'function' && define.amd)
define(["hammerjs", "iscroll", "lrz"], factory);
else if(typeof exports === 'object')
exports["PhotoClip"] = factory(require("hammerjs"), require("iscroll/build/iscroll-zoom"), require("lrz"));
else
root["PhotoClip"] = factory(root["Hammer"], root["IScroll"], root["lrz"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE__5__, __WEBPACK_EXTERNAL_MODULE__6__, __WEBPACK_EXTERNAL_MODULE__7__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断对象是否为数组
module.exports = function (obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
};
});
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// 判断是否为一个对象
module.exports = function (obj) {
return _typeof(obj) === 'object';
};
});
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断是否为数字类型
module.exports = function (num) {
return typeof num === 'number';
};
});
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
/**
* 让隐藏元素正确执行程序(IE9及以上浏览器)
* @param elems {DOM|Array} DOM元素或者DOM元素组成的数组
* @param func {Function} 需要执行的程序函数
* @param target {Object} 执行程序时函数中 this 的指向
*/
var defaultDisplayMap = {};
module.exports = function (elems, func, target) {
if (_typeof(elems) !== 'object') {
elems = [];
}
if (typeof elems.length === 'undefined') {
elems = [elems];
}
var hideElems = [],
hideElemsDisplay = [];
for (var i = 0, elem; elem = elems[i++];) {
while (elem instanceof HTMLElement) {
var nodeName = elem.nodeName;
if (!elem.getClientRects().length) {
hideElems.push(elem);
hideElemsDisplay.push(elem.style.display);
var display = defaultDisplayMap[nodeName];
if (!display) {
var temp = document.createElement(nodeName);
document.body.appendChild(temp);
display = window.getComputedStyle(temp).display;
temp.parentNode.removeChild(temp);
if (display === 'none') display = 'block';
defaultDisplayMap[nodeName] = display;
}
elem.style.display = display;
}
if (nodeName === 'BODY') break;
elem = elem.parentNode;
}
}
if (typeof func === 'function') func.call(target || this);
var l = hideElems.length;
while (l--) {
hideElems.pop().style.display = hideElemsDisplay.pop();
}
};
});
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(5), __webpack_require__(6), __webpack_require__(7), __webpack_require__(8), __webpack_require__(9), __webpack_require__(10), __webpack_require__(2), __webpack_require__(0), __webpack_require__(14), __webpack_require__(15), __webpack_require__(16), __webpack_require__(3), __webpack_require__(17), __webpack_require__(18), __webpack_require__(19), __webpack_require__(20), __webpack_require__(22)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function (_exports, _hammerjs, _iscrollZoom, _lrz, _bind, _destroy2, _extend, _isNumber, _isArray, _isPercent, _createElement, _removeElement, _hideAction, _support, _css, _attr, _$, utils) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports["default"] = void 0;
_hammerjs = _interopRequireDefault(_hammerjs);
_iscrollZoom = _interopRequireDefault(_iscrollZoom);
_lrz = _interopRequireDefault(_lrz);
_bind = _interopRequireDefault(_bind);
_destroy2 = _interopRequireDefault(_destroy2);
_extend = _interopRequireDefault(_extend);
_isNumber = _interopRequireDefault(_isNumber);
_isArray = _interopRequireDefault(_isArray);
_isPercent = _interopRequireDefault(_isPercent);
_createElement = _interopRequireDefault(_createElement);
_removeElement = _interopRequireDefault(_removeElement);
_hideAction = _interopRequireDefault(_hideAction);
_support = _interopRequireDefault(_support);
_css = _interopRequireDefault(_css);
_attr = _interopRequireDefault(_attr);
_$ = _interopRequireDefault(_$);
utils = _interopRequireWildcard(utils);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var is_mobile = !!navigator.userAgent.match(/mobile/i),
is_android = !!navigator.userAgent.match(/android/i),
// 测试浏览器是否支持 Transition 动画,以及支持的前缀
supportTransition = (0, _support["default"])('transition'),
prefix = (0, _support["default"])('transform'),
noop = function noop() {};
var defaultOptions = {
size: [100, 100],
adaptive: '',
outputSize: [0, 0],
outputType: 'jpg',
outputQuality: .8,
maxZoom: 1,
rotateFree: !is_android,
view: '',
file: '',
ok: '',
img: '',
loadStart: noop,
loadComplete: noop,
loadError: noop,
done: noop,
fail: noop,
lrzOption: {
width: is_android ? 1000 : undefined,
height: is_android ? 1000 : undefined,
quality: .7
},
style: {
maskColor: 'rgba(0,0,0,.5)',
maskBorder: '2px dashed #ddd',
jpgFillColor: '#fff'
},
errorMsg: {
noSupport: '您的浏览器版本过于陈旧,无法支持裁图功能,请更换新的浏览器!',
imgError: '不支持该图片格式,请选择常规格式的图片文件!',
imgHandleError: '图片处理失败!请更换其它图片尝试。',
imgLoadError: '图片读取失败!请更换其它图片尝试。',
noImg: '没有可裁剪的图片!',
clipError: '截图失败!当前图片源文件可能存在跨域问题,请确保图片与应用同源。如果您是在本地环境下执行本程序,请更换至服务器环境。'
}
};
var PhotoClip =
/*#__PURE__*/
function () {
function PhotoClip(container, options) {
_classCallCheck(this, PhotoClip);
container = (0, _$["default"])(container); // 获取容器
if (container && container.length) {
this._$container = container[0];
} else {
return;
}
this._options = (0, _extend["default"])(true, {}, defaultOptions, options);
if (prefix === undefined) {
this._options.errorMsg.noSupport && alert(this._options.errorMsg.noSupport);
}
this._init();
}
_createClass(PhotoClip, [{
key: "_init",
value: function _init() {
var _this = this;
var options = this._options; // options 预设
if ((0, _isNumber["default"])(options.size)) {
options.size = [options.size, options.size];
} else if ((0, _isArray["default"])(options.size)) {
if (!(0, _isNumber["default"])(options.size[0]) || options.size[0] <= 0) options.size[0] = defaultOptions.size[0];
if (!(0, _isNumber["default"])(options.size[1]) || options.size[1] <= 0) options.size[1] = defaultOptions.size[1];
} else {
options.size = (0, _extend["default"])({}, defaultOptions.size);
}
if ((0, _isNumber["default"])(options.outputSize)) {
options.outputSize = [options.outputSize, 0];
} else if ((0, _isArray["default"])(options.outputSize)) {
if (!(0, _isNumber["default"])(options.outputSize[0]) || options.outputSize[0] < 0) options.outputSize[0] = defaultOptions.outputSize[0];
if (!(0, _isNumber["default"])(options.outputSize[1]) || options.outputSize[1] < 0) options.outputSize[1] = defaultOptions.outputSize[1];
} else {
options.outputSize = (0, _extend["default"])({}, defaultOptions.outputSize);
}
if (options.outputType === 'jpg') {
options.outputType = 'image/jpeg';
} else {
// 如果不是 jpg,则全部按 png 来对待
options.outputType = 'image/png';
} // 变量初始化
if ((0, _isArray["default"])(options.adaptive)) {
this._widthIsPercent = options.adaptive[0] && (0, _isPercent["default"])(options.adaptive[0]) ? options.adaptive[0] : false;
this._heightIsPercent = options.adaptive[1] && (0, _isPercent["default"])(options.adaptive[1]) ? options.adaptive[1] : false;
}
this._outputWidth = options.outputSize[0];
this._outputHeight = options.outputSize[1];
this._canvas = document.createElement('canvas'); // 图片裁剪用到的画布
this._iScroll = null; // 图片的scroll对象,包含图片的位置与缩放信息
this._hammerManager = null; // hammer 管理对象
this._clipWidth = 0;
this._clipHeight = 0;
this._clipSizeRatio = 1; // 截取框宽高比
this._$img = null; // 图片的DOM对象
this._imgLoaded = false; // 图片是否已经加载完成
this._containerWidth = 0;
this._containerHeight = 0;
this._viewList = null; // 最终截图后呈现的视图容器的DOM数组
this._fileList = null; // file 控件的DOM数组
this._okList = null; // 截图按钮的DOM数组
this._$mask = null;
this._$mask_left = null;
this._$mask_right = null;
this._$mask_right = null;
this._$mask_bottom = null;
this._$clip_frame = null;
this._$clipLayer = null; // 裁剪层,包含移动层
this._$moveLayer = null; // 移动层,包含旋转层
this._$rotateLayer = null; // 旋转层
this._moveLayerWidth = 0; // 移动层的宽度(不跟随scale发生变化)
this._moveLayerHeight = 0; // 移动层的高度(不跟随scale发生变化)
this._moveLayerPaddingLeft = 0; // 当图片宽度小于裁剪框宽度时,移动层的补偿左边距(不跟随scale发生变化)
this._moveLayerPaddingTop = 0; // 当图片高度小于裁剪框高度时,移动层的补偿顶边距(不跟随scale发生变化)
this._atRotation = false; // 旋转层是否正在旋转中
this._rotateLayerWidth = 0; // 旋转层所呈现矩形的宽度(不跟随scale发生变化)
this._rotateLayerHeight = 0; // 旋转层所呈现矩形的高度(不跟随scale发生变化)
this._rotateLayerX = 0; // 旋转层的当前X坐标(不跟随scale发生变化)
this._rotateLayerY = 0; // 旋转层的当前Y坐标(不跟随scale发生变化)
this._rotateLayerOriginX = 0; // 旋转层的旋转参考点X(不跟随scale发生变化)
this._rotateLayerOriginY = 0; // 旋转层的旋转参考点Y(不跟随scale发生变化)
this._curAngle = 0; // 旋转层的当前角度
(0, _bind["default"])(this, '_resetScroll', '_rotateCW90', '_fileOnChangeHandle', '_clipImg', '_resize', 'size', 'load', 'clear', 'rotate', 'scale', 'clip', 'destroy');
this._initElements();
this._initScroll();
this._initRotationEvent();
this._initFile();
this._resize();
window.addEventListener('resize', this._resize);
if (this._okList = (0, _$["default"])(options.ok)) {
this._okList.forEach(function ($ok) {
$ok.addEventListener('click', _this._clipImg);
});
}
if (this._options.img) {
this._lrzHandle(this._options.img);
}
}
}, {
key: "_initElements",
value: function _initElements() {
// 初始化容器
var $container = this._$container,
style = $container.style,
containerOriginStyle = {};
containerOriginStyle['user-select'] = style['user-select'];
containerOriginStyle['overflow'] = style['overflow'];
containerOriginStyle['position'] = style['position'];
this._containerOriginStyle = containerOriginStyle;
(0, _css["default"])($container, {
'user-select': 'none',
'overflow': 'hidden'
});
if ((0, _css["default"])($container, 'position') === 'static') {
(0, _css["default"])($container, 'position', 'relative');
} // 创建裁剪层
this._$clipLayer = (0, _createElement["default"])($container, 'photo-clip-layer', {
'position': 'absolute',
'left': '50%',
'top': '50%'
});
this._$moveLayer = (0, _createElement["default"])(this._$clipLayer, 'photo-clip-move-layer');
this._$rotateLayer = (0, _createElement["default"])(this._$moveLayer, 'photo-clip-rotate-layer'); // 创建遮罩
var $mask = this._$mask = (0, _createElement["default"])($container, 'photo-clip-mask', {
'position': 'absolute',
'left': 0,
'top': 0,
'width': '100%',
'height': '100%',
'pointer-events': 'none'
});
var options = this._options,
maskColor = options.style.maskColor,
maskBorder = options.style.maskBorder;
this._$mask_left = (0, _createElement["default"])($mask, 'photo-clip-mask-left', {
'position': 'absolute',
'left': 0,
'right': '50%',
'top': '50%',
'bottom': '50%',
'width': 'auto',
'background-color': maskColor
});
this._$mask_right = (0, _createElement["default"])($mask, 'photo-clip-mask-right', {
'position': 'absolute',
'left': '50%',
'right': 0,
'top': '50%',
'bottom': '50%',
'background-color': maskColor
});
this._$mask_top = (0, _createElement["default"])($mask, 'photo-clip-mask-top', {
'position': 'absolute',
'left': 0,
'right': 0,
'top': 0,
'bottom': '50%',
'background-color': maskColor
});
this._$mask_bottom = (0, _createElement["default"])($mask, 'photo-clip-mask-bottom', {
'position': 'absolute',
'left': 0,
'right': 0,
'top': '50%',
'bottom': 0,
'background-color': maskColor
}); // 创建截取框
this._$clip_frame = (0, _createElement["default"])($mask, 'photo-clip-area', {
'border': maskBorder,
'position': 'absolute',
'left': '50%',
'top': '50%'
}); // 初始化视图容器
this._viewList = (0, _$["default"])(options.view);
if (this._viewList) {
var viewOriginStyleList = [];
this._viewList.forEach(function ($view, i) {
var style = $view.style,
viewOriginStyle = {};
viewOriginStyle['background-repeat'] = style['background-repeat'];
viewOriginStyle['background-position'] = style['background-position'];
viewOriginStyle['background-size'] = style['background-size'];
viewOriginStyleList[i] = viewOriginStyle;
(0, _css["default"])($view, {
'background-repeat': 'no-repeat',
'background-position': 'center',
'background-size': 'contain'
});
});
this._viewOriginStyleList = viewOriginStyleList;
}
}
}, {
key: "_initScroll",
value: function _initScroll() {
var _this2 = this;
this._iScroll = new _iscrollZoom["default"](this._$clipLayer, {
zoom: true,
scrollX: true,
scrollY: true,
freeScroll: true,
mouseWheel: true,
disablePointer: true,
// important to disable the pointer events that causes the issues
disableTouch: false,
// false if you want the slider to be usable with touch devices
disableMouse: false,
// false if you want the slider to be usable with a mouse (desktop)
wheelAction: 'zoom',
bounceTime: 300
});
this._iScroll.on('zoomEnd', function () {
_this2._calcScale();
_this2._resizeMoveLayer();
_this2._refreshScroll();
});
} // 重置 iScroll
}, {
key: "_resetScroll",
value: function _resetScroll() {
var iScroll = this._iScroll;
this._calcScale();
var scale = iScroll.scale = iScroll.options.startZoom;
this._resizeMoveLayer(); // 重置旋转层
this._rotateLayerX = 0;
this._rotateLayerY = 0;
this._curAngle = 0;
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, this._curAngle); // 初始化居中
iScroll.scrollTo((this._clipWidth - this._moveLayerWidth * scale) * .5, (this._clipHeight - this._moveLayerHeight * scale) * .5);
this._refreshScroll();
} // 刷新 iScroll
// duration 表示移动层超出容器时的复位动画持续时长
}, {
key: "_refreshScroll",
value: function _refreshScroll(duration) {
duration = duration || 0;
var iScroll = this._iScroll,
scale = iScroll.scale,
iScrollOptions = iScroll.options;
var lastScale = Math.max(iScrollOptions.zoomMin, Math.min(iScrollOptions.zoomMax, scale));
if (lastScale !== scale) {
iScroll.zoom(lastScale, undefined, undefined, duration);
}
iScroll.refresh(duration);
} // 调整移动层
}, {
key: "_resizeMoveLayer",
value: function _resizeMoveLayer() {
var iScroll = this._iScroll,
iScrollOptions = iScroll.options,
scale = Math.max(iScrollOptions.zoomMin, Math.min(iScrollOptions.zoomMax, iScroll.scale));
var width = this._rotateLayerWidth,
height = this._rotateLayerHeight,
clipWidth = this._clipWidth / scale,
clipHeight = this._clipHeight / scale,
ltClipArea = false;
if (clipWidth > width) {
ltClipArea = true;
var offset = clipWidth - width;
width += offset * 2;
iScroll.x += (this._moveLayerPaddingLeft - offset) * scale;
this._moveLayerPaddingLeft = offset;
} else {
this._moveLayerPaddingLeft = 0;
}
if (clipHeight > height) {
ltClipArea = true;
var _offset = clipHeight - height;
height += _offset * 2;
iScroll.y += (this._moveLayerPaddingTop - _offset) * scale;
this._moveLayerPaddingTop = _offset;
} else {
this._moveLayerPaddingTop = 0;
}
if (ltClipArea) {
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, this._curAngle);
iScroll.scrollTo(iScroll.x, iScroll.y);
}
if (this._moveLayerWidth === width && this._moveLayerHeight === height) return;
this._moveLayerWidth = width;
this._moveLayerHeight = height;
(0, _css["default"])(this._$moveLayer, {
'width': width,
'height': height
}); // 在移动设备上,尤其是Android设备,当为一个元素重置了宽高时
// 该元素的 offsetWidth/offsetHeight、clientWidth/clientHeight 等属性并不会立即更新,导致相关的js程序出现错误
// iscroll 在刷新方法中正是使用了 offsetWidth/offsetHeight 来获取scroller元素($moveLayer)的宽高
// 因此需要手动将元素重新添加进文档,迫使浏览器强制更新元素的宽高
this._$clipLayer.appendChild(this._$moveLayer);
}
}, {
key: "_calcScale",
value: function _calcScale() {
var iScroll = this._iScroll,
iScrollOptions = iScroll.options,
width = this._rotateLayerWidth,
height = this._rotateLayerHeight,
maxZoom = this._options.maxZoom;
if (width && height) {
iScrollOptions.zoomMin = Math.min(1, utils.getScale(this._clipWidth, this._clipHeight, width, height));
iScrollOptions.zoomMax = maxZoom;
iScrollOptions.startZoom = Math.min(maxZoom, utils.getScale(this._containerWidth, this._containerHeight, width, height));
} else {
iScrollOptions.zoomMin = 1;
iScrollOptions.zoomMax = 1;
iScrollOptions.startZoom = 1;
} // console.log('zoomMin', iScrollOptions.zoomMin);
// console.log('zoomMax', iScrollOptions.zoomMax);
// console.log('startZoom', iScrollOptions.startZoom);
}
}, {
key: "_initRotationEvent",
value: function _initRotationEvent() {
var _this3 = this;
if (is_mobile) {
this._hammerManager = new _hammerjs["default"].Manager(this._$moveLayer);
this._hammerManager.add(new _hammerjs["default"].Rotate());
var rotateFree = this._options.rotateFree,
bounceTime = this._iScroll.options.bounceTime;
var startTouch, startAngle, curAngle;
this._hammerManager.on('rotatestart', function (e) {
if (_this3._atRotation) return;
startTouch = true;
if (rotateFree) {
startAngle = (e.rotation - _this3._curAngle) % 360;
_this3._rotateLayerRotateReady(e.center);
} else {
startAngle = e.rotation;
}
});
this._hammerManager.on('rotatemove', function (e) {
if (!startTouch) return;
curAngle = e.rotation - startAngle;
rotateFree && _this3._rotateLayerRotate(curAngle);
});
this._hammerManager.on('rotateend rotatecancel', function (e) {
if (!startTouch) return;
startTouch = false;
if (!rotateFree) {
curAngle %= 360;
if (curAngle > 180) curAngle -= 360;else if (curAngle < -180) curAngle += 360;
if (curAngle > 30) {
_this3._rotateBy(90, bounceTime, e.center);
} else if (curAngle < -30) {
_this3._rotateBy(-90, bounceTime, e.center);
}
return;
} // 接近整90度方向时,进行校正
var angle = curAngle % 360;
if (angle < 0) angle += 360;
if (angle < 10) {
curAngle += -angle;
} else if (angle > 80 && angle < 100) {
curAngle += 90 - angle;
} else if (angle > 170 && angle < 190) {
curAngle += 180 - angle;
} else if (angle > 260 && angle < 280) {
curAngle += 270 - angle;
} else if (angle > 350) {
curAngle += 360 - angle;
}
_this3._rotateLayerRotateFinish(curAngle, bounceTime);
});
} else {
this._$moveLayer.addEventListener('dblclick', this._rotateCW90);
}
}
}, {
key: "_rotateCW90",
value: function _rotateCW90(e) {
this._rotateBy(90, this._iScroll.options.bounceTime, {
x: e.clientX,
y: e.clientY
});
}
}, {
key: "_rotateBy",
value: function _rotateBy(angle, duration, center) {
this._rotateTo(this._curAngle + angle, duration, center);
}
}, {
key: "_rotateTo",
value: function _rotateTo(angle, duration, center) {
if (this._atRotation) return;
this._rotateLayerRotateReady(center); // 旋转层旋转结束
this._rotateLayerRotateFinish(angle, duration);
} // 旋转层旋转准备
}, {
key: "_rotateLayerRotateReady",
value: function _rotateLayerRotateReady(center) {
var scale = this._iScroll.scale;
var coord; // 旋转参考点在移动层中的坐标
if (!center) {
coord = utils.loaclToLoacl(this._$moveLayer, this._$clipLayer, this._clipWidth * .5, this._clipHeight * .5);
} else {
coord = utils.globalToLoacl(this._$moveLayer, center.x, center.y);
} // 由于得到的坐标是在缩放后坐标系上的坐标,因此需要除以缩放比例
coord.x /= scale;
coord.y /= scale; // 旋转参考点相对于旋转层零位(旋转层旋转前左上角)的坐标
var coordBy0 = {
x: coord.x - (this._rotateLayerX + this._moveLayerPaddingLeft),
y: coord.y - (this._rotateLayerY + this._moveLayerPaddingTop)
}; // 求出旋转层旋转前的旋转参考点
// 这个参考点就是旋转中心点映射在旋转层图片上的坐标
// 这个位置表示旋转层旋转前,该点所对应的坐标
var origin = utils.pointRotate(coordBy0, -this._curAngle);
this._rotateLayerOriginX = origin.x;
this._rotateLayerOriginY = origin.y; // 设置参考点,算出新参考点作用下的旋转层位移,然后进行补差
var rect = this._$rotateLayer.getBoundingClientRect();
setOrigin(this._$rotateLayer, this._rotateLayerOriginX, this._rotateLayerOriginY);
var newRect = this._$rotateLayer.getBoundingClientRect();
this._rotateLayerX += (rect.left - newRect.left) / scale;
this._rotateLayerY += (rect.top - newRect.top) / scale;
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, this._curAngle);
} // 旋转层旋转
}, {
key: "_rotateLayerRotate",
value: function _rotateLayerRotate(angle) {
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, angle);
this._curAngle = angle;
} // 旋转层旋转结束
}, {
key: "_rotateLayerRotateFinish",
value: function _rotateLayerRotateFinish(angle, duration) {
var _this4 = this;
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, angle);
var iScroll = this._iScroll,
scale = iScroll.scale,
iScrollOptions = iScroll.options; // 获取旋转后的矩形
var rect = this._$rotateLayer.getBoundingClientRect(); // 更新旋转层当前所呈现矩形的宽高
this._rotateLayerWidth = rect.width / scale;
this._rotateLayerHeight = rect.height / scale; // 当参考点为零时,获取位移后的矩形
setOrigin(this._$rotateLayer, 0, 0);
var rectByOrigin0 = this._$rotateLayer.getBoundingClientRect(); // 获取旋转前(零度)的矩形
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, 0);
var rectByAngle0 = this._$rotateLayer.getBoundingClientRect(); // 当参考点为零时,旋转层旋转后,在形成的新矩形中,旋转层零位(旋转层旋转前左上角)的新坐标
this._rotateLayerX = (rectByAngle0.left - rectByOrigin0.left) / scale;
this._rotateLayerY = (rectByAngle0.top - rectByOrigin0.top) / scale;
this._calcScale();
this._resizeMoveLayer(); // 获取移动层的矩形
var moveLayerRect = this._$moveLayer.getBoundingClientRect(); // 求出移动层与旋转层之间的位置偏移
// 由于直接应用在移动层,因此不需要根据缩放换算
// 注意,这里的偏移有可能还包含缩放过量时多出来的偏移
var offset = {
x: rect.left - this._moveLayerPaddingLeft * scale - moveLayerRect.left,
y: rect.top - this._moveLayerPaddingTop * scale - moveLayerRect.top
};
iScroll.scrollTo(iScroll.x + offset.x, iScroll.y + offset.y);
this._refreshScroll(iScroll.options.bounceTime); // 由于 offset 可能还包含缩放过量时多出来的偏移
// 因此,这里判断是否缩放过量
var lastScale = Math.max(iScrollOptions.zoomMin, Math.min(iScrollOptions.zoomMax, scale));
if (lastScale !== scale) {
// 当缩放过量时,将 offset 换算为最终的正常比例对应的值
offset.x = offset.x / scale * lastScale;
offset.y = offset.y / scale * lastScale;
} // 由于双指旋转时也伴随着缩放,因此这里代码执行完后,将会执行 iscroll 的 _zoomEnd
// 而该方法会基于 touchstart 时记录的位置重新计算 x、y,这将导致手指离开屏幕后,移动层又会向回移动一段距离
// 所以这里也要将 startX、startY 这两个值进行补差,而这个差值必须是最终的正常比例对应的值
iScroll.startX += offset.x;
iScroll.startY += offset.y;
if (angle !== this._curAngle && duration && (0, _isNumber["default"])(duration) && supportTransition !== undefined) {
// 计算旋转层参考点,设为零位前后的偏移量
offset = {
x: (rectByOrigin0.left - rect.left) / scale,
y: (rectByOrigin0.top - rect.top) / scale
}; // 将旋转参考点设回前值,同时调整偏移量,保证视图位置不变,准备开始动画
setOrigin(this._$rotateLayer, this._rotateLayerOriginX, this._rotateLayerOriginY);
var targetX = this._rotateLayerX + this._moveLayerPaddingLeft + offset.x,
targetY = this._rotateLayerY + this._moveLayerPaddingTop + offset.y;
setTransform(this._$rotateLayer, targetX, targetY, this._curAngle); // 开始旋转
this._atRotation = true;
setTransition(this._$rotateLayer, targetX, targetY, angle, duration, function () {
_this4._atRotation = false;
_this4._rotateFinishUpdataElem(angle);
});
} else {
this._rotateFinishUpdataElem(angle);
}
} // 旋转结束更新相关元素
}, {
key: "_rotateFinishUpdataElem",
value: function _rotateFinishUpdataElem(angle) {
setOrigin(this._$rotateLayer, this._rotateLayerOriginX = 0, this._rotateLayerOriginY = 0);
setTransform(this._$rotateLayer, this._rotateLayerX + this._moveLayerPaddingLeft, this._rotateLayerY + this._moveLayerPaddingTop, this._curAngle = angle % 360);
}
}, {
key: "_initFile",
value: function _initFile() {
var _this5 = this;
var options = this._options;
if (this._fileList = (0, _$["default"])(options.file)) {
this._fileList.forEach(function ($file) {
// 移动端如果设置 'accept',会使相册打开缓慢,因此这里只为非移动端设置
if (!is_mobile) {
(0, _attr["default"])($file, 'accept', 'image/jpeg, image/x-png, image/png, image/gif');
}
$file.addEventListener('change', _this5._fileOnChangeHandle);
});
}
}
}, {
key: "_fileOnChangeHandle",
value: function _fileOnChangeHandle(e) {
var files = e.target.files;
if (files.length) {
this._lrzHandle(files[0]);
}
}
}, {
key: "_lrzHandle",
value: function _lrzHandle(src) {
var _this6 = this;
var options = this._options,
errorMsg = options.errorMsg;
if (_typeof(src) === 'object' && src.type && !/image\/\w+/.test(src.type)) {
options.loadError.call(this, errorMsg.imgError);
return false;
}
this._imgLoaded = false;
options.loadStart.call(this, src);
try {
(0, _lrz["default"])(src, options.lrzOption).then(function (rst) {
// 处理成功会执行
_this6._clearImg();
_this6._createImg(rst.base64);
})["catch"](function (err) {
// 处理失败会执行
options.loadError.call(_this6, errorMsg.imgHandleError, err);
});
} catch (err) {
options.loadError.call(this, errorMsg.imgHandleError, err);
throw err;
}
}
}, {
key: "_clearImg",
value: function _clearImg() {
if (!this._$img) return; // 删除旧的图片以释放内存,防止IOS设备的 webview 崩溃
this._$img.onload = null;
this._$img.onerror = null;
(0, _removeElement["default"])(this._$img);
this._$img = null;
this._imgLoaded = false;
}
}, {
key: "_createImg",
value: function _createImg(src) {
var _this7 = this;
var options = this._options,
errorMsg = options.errorMsg;
this._$img = new Image();
(0, _css["default"])(this._$img, {
'display': 'block',
'user-select': 'none',
'pointer-events': 'none'
});
this._$img.onload = function (e) {
var img = e.target;
_this7._imgLoaded = true;
options.loadComplete.call(_this7, img);
_this7._$rotateLayer.appendChild(img);
_this7._rotateLayerWidth = img.naturalWidth;
_this7._rotateLayerHeight = img.naturalHeight;
(0, _css["default"])(_this7._$rotateLayer, {
'width': _this7._rotateLayerWidth,
'height': _this7._rotateLayerHeight
});
(0, _hideAction["default"])([img, _this7._$moveLayer], _this7._resetScroll);
};
this._$img.onerror = function (e) {
options.loadError.call(_this7, errorMsg.imgLoadError, e);
};
(0, _attr["default"])(this._$img, 'src', src);
}
}, {
key: "_clipImg",
value: function _clipImg() {
var options = this._options,
errorMsg = options.errorMsg;
if (!this._imgLoaded) {
options.fail.call(this, errorMsg.noImg);
return;
}
var local = utils.loaclToLoacl(this._$moveLayer, this._$clipLayer),
scale = this._iScroll.scale,
ctx = this._canvas.getContext('2d');
var scaleX = 1,
scaleY = 1;
if (this._outputWidth || this._outputHeight) {
this._canvas.width = this._outputWidth;
this._canvas.height = this._outputHeight;
scaleX = this._outputWidth / this._clipWidth * scale;
scaleY = this._outputHeight / this._clipHeight * scale;
} else {
this._canvas.width = this._clipWidth / scale;
this._canvas.height = this._clipHeight / scale;
}
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
ctx.fillStyle = options.outputType === 'image/png' ? 'transparent' : options.style.jpgFillColor;
ctx.fillRect(0, 0, this._canvas.width, this._canvas.height);
ctx.save();
ctx.scale(scaleX, scaleY);
ctx.translate(this._rotateLayerX + this._moveLayerPaddingLeft - local.x / scale, this._rotateLayerY + this._moveLayerPaddingTop - local.y / scale);
ctx.rotate(this._curAngle * Math.PI / 180);
ctx.drawImage(this._$img, 0, 0);
ctx.restore();
try {
var dataURL = this._canvas.toDataURL(options.outputType, options.outputQuality);
if (this._viewList) {
this._viewList.forEach(function ($view) {
(0, _css["default"])($view, 'background-image', "url(".concat(dataURL, ")"));
});
}
options.done.call(this, dataURL);
return dataURL;
} catch (err) {
options.fail.call(this, errorMsg.clipError);
throw err;
}
}
}, {
key: "_resize",
value: function _resize(width, height) {
(0, _hideAction["default"])(this._$container, function () {
this._containerWidth = this._$container.offsetWidth;
this._containerHeight = this._$container.offsetHeight;
}, this);
var size = this._options.size,
oldClipWidth = this._clipWidth,
oldClipHeight = this._clipHeight;
if ((0, _isNumber["default"])(width)) size[0] = width;
if ((0, _isNumber["default"])(height)) size[1] = height;
if (this._widthIsPercent || this._heightIsPercent) {
var ratio = size[0] / size[1];
if (this._widthIsPercent) {
this._clipWidth = this._containerWidth / 100 * parseFloat(this._widthIsPercent);
if (!this._heightIsPercent) {
this._clipHeight = this._clipWidth / ratio;
}
}
if (this._heightIsPercent) {
this._clipHeight = this._containerHeight / 100 * parseFloat(this._heightIsPercent);
if (!this._widthIsPercent) {
this._clipWidth = this._clipHeight * ratio;
}
}
} else {
this._clipWidth = size[0];
this._clipHeight = size[1];
}
var clipWidth = this._clipWidth,
clipHeight = this._clipHeight;
this._clipSizeRatio = clipWidth / clipHeight;
if (this._outputWidth && !this._outputHeight) {
this._outputHeight = this._outputWidth / this._clipSizeRatio;
}
if (this._outputHeight && !this._outputWidth) {
this._outputWidth = this._outputHeight * this._clipSizeRatio;
}
(0, _css["default"])(this._$clipLayer, {
'width': clipWidth,
'height': clipHeight,
'margin-left': -clipWidth / 2,
'margin-top': -clipHeight / 2
});
(0, _css["default"])(this._$mask_left, {
'margin-right': clipWidth / 2,
'margin-top': -clipHeight / 2,
'margin-bottom': -clipHeight / 2
});
(0, _css["default"])(this._$mask_right, {
'margin-left': clipWidth / 2,
'margin-top': -clipHeight / 2,
'margin-bottom': -clipHeight / 2
});
(0, _css["default"])(this._$mask_top, {
'margin-bottom': clipHeight / 2
});
(0, _css["default"])(this._$mask_bottom, {
'margin-top': clipHeight / 2
});
(0, _css["default"])(this._$clip_frame, {
'width': clipWidth,
'height': clipHeight
});
(0, _css["default"])(this._$clip_frame, prefix + 'transform', 'translate(-50%, -50%)');
if (clipWidth !== oldClipWidth || clipHeight !== oldClipHeight) {
this._calcScale();
this._resizeMoveLayer();
this._refreshScroll();
var iScroll = this._iScroll,
scale = iScroll.scale,
offsetX = (clipWidth - oldClipWidth) * .5 * scale,
offsetY = (clipHeight - oldClipHeight) * .5 * scale;
iScroll.scrollBy(offsetX, offsetY);
}
}
/**
* 设置截取框的宽高
* 如果设置了 adaptive 选项,则该方法仅用于修改截取框的宽高比例
* @param {Number} width 截取框的宽度
* @param {Number} height 截取框的高度
* @return {PhotoClip} 返回 PhotoClip 的实例对象
*/
}, {
key: "size",
value: function size(width, height) {
this._resize(width, height);
return this;
}
/**
* 加载一张图片
* @param {String|Object} src 图片的 url,或者图片的 file 文件对象
* @return {PhotoClip} 返回 PhotoClip 的实例对象
*/
}, {
key: "load",
value: function load(src) {
this._lrzHandle(src);
return this;
}
/**
* 清除当前图片
* @return {PhotoClip} 返回 PhotoClip 的实例对象
*/
}, {
key: "clear",
value: function clear() {
this._clearImg();
this._resetScroll();
if (this._fileList) {
this._fileList.forEach(function ($file) {
$file.value = '';
});
}
return this;
}
/**
* 图片旋转到指定角度
* @param {Number} angle 可选。旋转的角度
* @param {Number} duration 可选。旋转动画的时长,如果为 0 或 false,则表示没有过渡动画
* @return {PhotoClip|Number} 返回 PhotoClip 的实例对象。如果参数为空,则返回当前的旋转角度
*/
}, {
key: "rotate",
value: function rotate(angle, duration) {
if (angle === undefined) return this._curAngle;
this._rotateTo(angle, duration);
return this;
}
/**
* 图片缩放到指定比例,如果超出缩放范围,则会被缩放到可缩放极限
* @param {Number} zoom 可选。缩放比例,取值在 0 - 1 之间
* @param {Number} duration 可选。缩放动画的时长,如果为 0 或 false,则表示没有过渡动画
* @return {PhotoClip|Number} 返回 PhotoClip 的实例对象。如果参数为空,则返回当前的缩放比例
*/
}, {
key: "scale",
value: function scale(zoom, duration) {
if (zoom === undefined) return this._iScroll.scale;
this._iScroll.zoom(zoom, undefined, undefined, duration);
return this;
}
/**
* 截图
* @return {String} 返回截取后图片的 Base64 字符串
*/
}, {
key: "clip",
value: function clip() {
return this._clipImg();
}
/**
* 销毁
* @return {Undefined} 无返回值
*/
}, {
key: "destroy",
value: function destroy() {
var _this8 = this;
window.removeEventListener('resize', this._resize);
this._$container.removeChild(this._$clipLayer);
this._$container.removeChild(this._$mask);
(0, _css["default"])(this._$container, this._containerOriginStyle);
if (this._iScroll) {
this._iScroll.destroy();
}
if (this._hammerManager) {
this._hammerManager.off('rotatemove');
this._hammerManager.off('rotateend');
this._hammerManager.destroy();
} else {
this._$moveLayer.removeEventListener('dblclick', this._rotateCW90);
}
if (this._$img) {
this._$img.onload = null;
this._$img.onerror = null;
}
if (this._viewList) {
this._viewList.forEach(function ($view, i) {
(0, _css["default"])($view, _this8._viewOriginStyleList[i]);
});
}
if (this._fileList) {
this._fileList.forEach(function ($file) {
$file.removeEventListener('change', _this8._fileOnChangeHandle);
$file.value = null;
});
}
if (this._okList) {
this._okList.forEach(function ($ok) {
$ok.removeEventListener('click', _this8._clipImg);
});
}
(0, _destroy2["default"])(this);
}
}]);
return PhotoClip;
}();
_exports["default"] = PhotoClip;
; // 设置变换注册点
function setOrigin($obj, originX, originY) {
originX = (originX || 0).toFixed(2);
originY = (originY || 0).toFixed(2);
(0, _css["default"])($obj, prefix + 'transform-origin', originX + 'px ' + originY + 'px');
} // 设置变换坐标与旋转角度
function setTransform($obj, x, y, angle) {
// translate(x, y) 中坐标的小数点位数过多会引发 bug
// 因此这里需要保留两位小数
x = x.toFixed(2);
y = y.toFixed(2);
angle = angle.toFixed(2);
(0, _css["default"])($obj, prefix + 'transform', 'translateZ(0) translate(' + x + 'px,' + y + 'px) rotate(' + angle + 'deg)');
} // 设置变换动画
function setTransition($obj, x, y, angle, dur, fn) {
// 这里需要先读取之前设置好的transform样式,强制浏览器将该样式值渲染到元素
// 否则浏览器可能出于性能考虑,将暂缓样式渲染,等到之后所有样式设置完成后再统一渲染
// 这样就会导致之前设置的位移也被应用到动画中
(0, _css["default"])($obj, prefix + 'transform'); // 这里应用的缓动与 iScroll 的默认缓动相同
(0, _css["default"])($obj, prefix + 'transition', prefix + 'transform ' + dur + 'ms cubic-bezier(0.1, 0.57, 0.1, 1)');
setTransform($obj, x, y, angle);
setTimeout(function () {
(0, _css["default"])($obj, prefix + 'transition', '');
fn();
}, dur);
}
module.exports = exports.default;
});
/***/ }),
/* 5 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__5__;
/***/ }),
/* 6 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__6__;
/***/ }),
/* 7 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE__7__;
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
module.exports = function (context) {
for (var _len = arguments.length, methods = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
methods[_key - 1] = arguments[_key];
}
methods.forEach(function (method) {
context[method] = context[method].bind(context);
});
};
});
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
module.exports = function (context) {
// 清除所有属性
Object.getOwnPropertyNames(context).forEach(function (prop) {
delete context[prop];
});
context.__proto__ = Object.prototype;
};
});
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
var isArray = __webpack_require__(0);
var isObject = __webpack_require__(1);
var isBoolean = __webpack_require__(11);
var isFunction = __webpack_require__(12);
var isPlainObject = __webpack_require__(13);
module.exports = function extend() {
var options,
name,
src,
copy,
copyIsArray,
target = arguments[0] || {},
toString = Object.prototype.toString,
i = 1,
length = arguments.length,
deep = false; // 处理深拷贝
if (isBoolean(target)) {
deep = target; // Skip the boolean and the target
target = arguments[i] || {};
i++;
} // Handle case when target is a string or something (possible in deep copy)
if (!isObject(target) && !isFunction(target)) {
target = {};
} // 如果没有合并的对象,则表示 target 为合并对象,将 target 合并给当前函数的持有者
if (i === length) {
target = this;
i--;
}
for (; i < length; i++) {
// Only deal with non-null/undefined values
if ((options = arguments[i]) != null) {
// Extend the base object
for (name in options) {
src = target[name];
copy = options[name]; // 防止死循环
if (target === copy) {
continue;
} // 深拷贝对象或者数组
if (deep && copy && ((copyIsArray = isArray(copy)) || isPlainObject(copy))) {
if (copyIsArray) {
copyIsArray = false;
src = src && isArray(src) ? src : [];
} else {
src = src && isPlainObject(src) ? src : {};
}
target[name] = extend(deep, src, copy);
} else if (copy !== undefined) {
// 仅忽略未定义的值
target[name] = copy;
}
}
}
} // Return the modified object
return target;
};
});
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断是否为布尔值
module.exports = function (bool) {
return typeof bool === 'boolean';
};
});
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断是否为函数
module.exports = function (func) {
return typeof func === 'function';
};
});
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断对象是否为纯粹的对象(通过 "{}" 或者 "new Object" 创建的)
module.exports = function (obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
};
});
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 判断是否为百分比
module.exports = function (value) {
return /%$/.test(value + '');
};
});
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// 创建元素
module.exports = function (parentNode, className, id, prop) {
var elem = document.createElement('DIV');
if (_typeof(className) === 'object') {
prop = className;
className = null;
}
if (_typeof(id) === 'object') {
prop = id;
id = null;
}
if (_typeof(prop) === 'object') {
for (var p in prop) {
elem.style[p] = prop[p];
}
}
if (className) elem.className = className;
if (id) elem.id = id;
parentNode.appendChild(elem);
return elem;
};
});
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 移除元素
module.exports = function (elem) {
elem.parentNode && elem.parentNode.removeChild(elem);
};
});
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 返回指定属性在当前浏览器中的兼容前缀
// 如果无需兼容前缀,则返回一个空字符串
// all 是一个布尔值,如果为 true,则会返回包含前缀的属性名
module.exports = function (prop, all) {
var returnProp = all ? prop : '';
var testElem = document.documentElement;
if (prop in testElem.style) return returnProp;
var testProp = prop.charAt(0).toUpperCase() + prop.substr(1),
prefixs = ['Webkit', 'Moz', 'ms', 'O'];
for (var i = 0, prefix; prefix = prefixs[i++];) {
if (prefix + testProp in testElem.style) {
return '-' + prefix.toLowerCase() + '-' + returnProp;
}
}
return returnProp;
};
});
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 设置样式
var isObject = __webpack_require__(1);
var isNumber = __webpack_require__(2);
var cssNumber = {
'animationIterationCount': true,
'columnCount': true,
'fillOpacity': true,
'flexGrow': true,
'flexShrink': true,
'fontWeight': true,
'lineHeight': true,
'opacity': true,
'order': true,
'orphans': true,
'widows': true,
'zIndex': true,
'zoom': true
};
module.exports = function (elem, prop, value) {
if (isObject(prop)) {
for (var p in prop) {
value = prop[p];
if (isNumber(value) && !cssNumber[prop]) value += 'px';
elem.style[p] = value;
}
return elem;
}
if (value === undefined) {
return window.getComputedStyle(elem)[prop];
} else {
if (isNumber(value) && !cssNumber[prop]) value += 'px';
elem.style[prop] = value;
return elem;
}
};
});
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// 设置属性
module.exports = function (elem, prop, value) {
if (_typeof(prop) === 'object') {
for (var p in prop) {
elem[p] = prop[p];
}
return elem;
}
if (value === undefined) {
return elem[prop];
} else {
elem[prop] = value;
return elem;
}
};
});
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
var toArray = __webpack_require__(21); // 获取元素(IE8及以上浏览器)
module.exports = function (selector, context) {
if (selector instanceof HTMLElement) {
return [selector];
} else if (_typeof(selector) === 'object' && selector.length) {
return toArray(selector);
} else if (!selector || typeof selector !== 'string') {
return [];
}
if (typeof context === 'string') {
context = document.querySelector(context);
}
if (!(context instanceof HTMLElement)) {
context = document;
}
return toArray(context.querySelectorAll(selector));
};
});
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function () {
"use strict";
// 类似数组对象转数组
module.exports = function (obj) {
return Array.prototype.map.call(obj, function (n) {
return n;
});
};
});
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
if (true) {
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, __webpack_require__(3)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else { var mod; }
})(this, function (_exports, _hideAction) {
"use strict";
Object.defineProperty(_exports, "__esModule", {
value: true
});
_exports.getScale = getScale;
_exports.pointRotate = pointRotate;
_exports.angleToRadian = angleToRadian;
_exports.loaclToLoacl = loaclToLoacl;
_exports.globalToLoacl = globalToLoacl;
_hideAction = _interopRequireDefault(_hideAction);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// 获取最大缩放比例
function getScale(w1, h1, w2, h2) {
var sx = w1 / w2;
var sy = h1 / h2;
return sx > sy ? sx : sy;
} // 计算一个点绕原点旋转后的新坐标
function pointRotate(point, angle) {
var radian = angleToRadian(angle),
sin = Math.sin(radian),
cos = Math.cos(radian);
return {
x: cos * point.x - sin * point.y,
y: cos * point.y + sin * point.x
};
} // 角度转弧度
function angleToRadian(angle) {
return angle / 180 * Math.PI;
} // 计算layerTwo上的x、y坐标在layerOne上的坐标
function loaclToLoacl(layerOne, layerTwo, x, y) {
x = x || 0;
y = y || 0;
var layerOneRect, layerTwoRect;
(0, _hideAction["default"])([layerOne, layerTwo], function () {
layerOneRect = layerOne.getBoundingClientRect();
layerTwoRect = layerTwo.getBoundingClientRect();
});
return {
x: layerTwoRect.left - layerOneRect.left + x,
y: layerTwoRect.top - layerOneRect.top + y
};
} // 计算相对于窗口的x、y坐标在layer上的坐标
function globalToLoacl(layer, x, y) {
x = x || 0;
y = y || 0;
var layerRect;
(0, _hideAction["default"])(layer, function () {
layerRect = layer.getBoundingClientRect();
});
return {
x: x - layerRect.left,
y: y - layerRect.top
};
}
});
/***/ })
/******/ ]);
});
\ No newline at end of file
/*! Hammer.JS - v2.0.8 - 2016-04-23
* http://hammerjs.github.io/
*
* Copyright (c) 2016 Jorik Tangelder;
* Licensed under the MIT license */
!(function(a, b, c, d) {
'use strict';
function e(a, b, c) {
return setTimeout(j(a, c), b);
}
function f(a, b, c) {
return Array.isArray(a) ? (g(a, c[b], c), !0) : !1;
}
function g(a, b, c) {
var e;
if (a)
if (a.forEach) a.forEach(b, c);
else if (a.length !== d)
for (e = 0; e < a.length; ) b.call(c, a[e], e, a), e++;
else for (e in a) a.hasOwnProperty(e) && b.call(c, a[e], e, a);
}
function h(b, c, d) {
var e = 'DEPRECATED METHOD: ' + c + '\n' + d + ' AT \n';
return function() {
var c = new Error('get-stack-trace'),
d =
c && c.stack
? c.stack
.replace(/^[^\(]+?[\n$]/gm, '')
.replace(/^\s+at\s+/gm, '')
.replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@')
: 'Unknown Stack Trace',
f = a.console && (a.console.warn || a.console.log);
return f && f.call(a.console, e, d), b.apply(this, arguments);
};
}
function i(a, b, c) {
var d,
e = b.prototype;
(d = a.prototype = Object.create(e)),
(d.constructor = a),
(d._super = e),
c && la(d, c);
}
function j(a, b) {
return function() {
return a.apply(b, arguments);
};
}
function k(a, b) {
return typeof a == oa ? a.apply(b ? b[0] || d : d, b) : a;
}
function l(a, b) {
return a === d ? b : a;
}
function m(a, b, c) {
g(q(b), function(b) {
a.addEventListener(b, c, !1);
});
}
function n(a, b, c) {
g(q(b), function(b) {
a.removeEventListener(b, c, !1);
});
}
function o(a, b) {
for (; a; ) {
if (a == b) return !0;
a = a.parentNode;
}
return !1;
}
function p(a, b) {
return a.indexOf(b) > -1;
}
function q(a) {
return a.trim().split(/\s+/g);
}
function r(a, b, c) {
if (a.indexOf && !c) return a.indexOf(b);
for (var d = 0; d < a.length; ) {
if ((c && a[d][c] == b) || (!c && a[d] === b)) return d;
d++;
}
return -1;
}
function s(a) {
return Array.prototype.slice.call(a, 0);
}
function t(a, b, c) {
for (var d = [], e = [], f = 0; f < a.length; ) {
var g = b ? a[f][b] : a[f];
r(e, g) < 0 && d.push(a[f]), (e[f] = g), f++;
}
return (
c &&
(d = b
? d.sort(function(a, c) {
return a[b] > c[b];
})
: d.sort()),
d
);
}
function u(a, b) {
for (
var c, e, f = b[0].toUpperCase() + b.slice(1), g = 0;
g < ma.length;
) {
if (((c = ma[g]), (e = c ? c + f : b), e in a)) return e;
g++;
}
return d;
}
function v() {
return ua++;
}
function w(b) {
var c = b.ownerDocument || b;
return c.defaultView || c.parentWindow || a;
}
function x(a, b) {
var c = this;
(this.manager = a),
(this.callback = b),
(this.element = a.element),
(this.target = a.options.inputTarget),
(this.domHandler = function(b) {
k(a.options.enable, [a]) && c.handler(b);
}),
this.init();
}
function y(a) {
var b,
c = a.options.inputClass;
return new (b = c ? c : xa ? M : ya ? P : wa ? R : L)(a, z);
}
function z(a, b, c) {
var d = c.pointers.length,
e = c.changedPointers.length,
f = b & Ea && d - e === 0,
g = b & (Ga | Ha) && d - e === 0;
(c.isFirst = !!f),
(c.isFinal = !!g),
f && (a.session = {}),
(c.eventType = b),
A(a, c),
a.emit('hammer.input', c),
a.recognize(c),
(a.session.prevInput = c);
}
function A(a, b) {
var c = a.session,
d = b.pointers,
e = d.length;
c.firstInput || (c.firstInput = D(b)),
e > 1 && !c.firstMultiple
? (c.firstMultiple = D(b))
: 1 === e && (c.firstMultiple = !1);
var f = c.firstInput,
g = c.firstMultiple,
h = g ? g.center : f.center,
i = (b.center = E(d));
(b.timeStamp = ra()),
(b.deltaTime = b.timeStamp - f.timeStamp),
(b.angle = I(h, i)),
(b.distance = H(h, i)),
B(c, b),
(b.offsetDirection = G(b.deltaX, b.deltaY));
var j = F(b.deltaTime, b.deltaX, b.deltaY);
(b.overallVelocityX = j.x),
(b.overallVelocityY = j.y),
(b.overallVelocity = qa(j.x) > qa(j.y) ? j.x : j.y),
(b.scale = g ? K(g.pointers, d) : 1),
(b.rotation = g ? J(g.pointers, d) : 0),
(b.maxPointers = c.prevInput
? b.pointers.length > c.prevInput.maxPointers
? b.pointers.length
: c.prevInput.maxPointers
: b.pointers.length),
C(c, b);
var k = a.element;
o(b.srcEvent.target, k) && (k = b.srcEvent.target), (b.target = k);
}
function B(a, b) {
var c = b.center,
d = a.offsetDelta || {},
e = a.prevDelta || {},
f = a.prevInput || {};
(b.eventType !== Ea && f.eventType !== Ga) ||
((e = a.prevDelta = { x: f.deltaX || 0, y: f.deltaY || 0 }),
(d = a.offsetDelta = { x: c.x, y: c.y })),
(b.deltaX = e.x + (c.x - d.x)),
(b.deltaY = e.y + (c.y - d.y));
}
function C(a, b) {
var c,
e,
f,
g,
h = a.lastInterval || b,
i = b.timeStamp - h.timeStamp;
if (b.eventType != Ha && (i > Da || h.velocity === d)) {
var j = b.deltaX - h.deltaX,
k = b.deltaY - h.deltaY,
l = F(i, j, k);
(e = l.x),
(f = l.y),
(c = qa(l.x) > qa(l.y) ? l.x : l.y),
(g = G(j, k)),
(a.lastInterval = b);
} else
(c = h.velocity), (e = h.velocityX), (f = h.velocityY), (g = h.direction);
(b.velocity = c), (b.velocityX = e), (b.velocityY = f), (b.direction = g);
}
function D(a) {
for (var b = [], c = 0; c < a.pointers.length; )
(b[c] = {
clientX: pa(a.pointers[c].clientX),
clientY: pa(a.pointers[c].clientY),
}),
c++;
return {
timeStamp: ra(),
pointers: b,
center: E(b),
deltaX: a.deltaX,
deltaY: a.deltaY,
};
}
function E(a) {
var b = a.length;
if (1 === b) return { x: pa(a[0].clientX), y: pa(a[0].clientY) };
for (var c = 0, d = 0, e = 0; b > e; )
(c += a[e].clientX), (d += a[e].clientY), e++;
return { x: pa(c / b), y: pa(d / b) };
}
function F(a, b, c) {
return { x: b / a || 0, y: c / a || 0 };
}
function G(a, b) {
return a === b ? Ia : qa(a) >= qa(b) ? (0 > a ? Ja : Ka) : 0 > b ? La : Ma;
}
function H(a, b, c) {
c || (c = Qa);
var d = b[c[0]] - a[c[0]],
e = b[c[1]] - a[c[1]];
return Math.sqrt(d * d + e * e);
}
function I(a, b, c) {
c || (c = Qa);
var d = b[c[0]] - a[c[0]],
e = b[c[1]] - a[c[1]];
return (180 * Math.atan2(e, d)) / Math.PI;
}
function J(a, b) {
return I(b[1], b[0], Ra) + I(a[1], a[0], Ra);
}
function K(a, b) {
return H(b[0], b[1], Ra) / H(a[0], a[1], Ra);
}
function L() {
(this.evEl = Ta),
(this.evWin = Ua),
(this.pressed = !1),
x.apply(this, arguments);
}
function M() {
(this.evEl = Xa),
(this.evWin = Ya),
x.apply(this, arguments),
(this.store = this.manager.session.pointerEvents = []);
}
function N() {
(this.evTarget = $a),
(this.evWin = _a),
(this.started = !1),
x.apply(this, arguments);
}
function O(a, b) {
var c = s(a.touches),
d = s(a.changedTouches);
return b & (Ga | Ha) && (c = t(c.concat(d), 'identifier', !0)), [c, d];
}
function P() {
(this.evTarget = bb), (this.targetIds = {}), x.apply(this, arguments);
}
function Q(a, b) {
var c = s(a.touches),
d = this.targetIds;
if (b & (Ea | Fa) && 1 === c.length)
return (d[c[0].identifier] = !0), [c, c];
var e,
f,
g = s(a.changedTouches),
h = [],
i = this.target;
if (
((f = c.filter(function(a) {
return o(a.target, i);
})),
b === Ea)
)
for (e = 0; e < f.length; ) (d[f[e].identifier] = !0), e++;
for (e = 0; e < g.length; )
d[g[e].identifier] && h.push(g[e]),
b & (Ga | Ha) && delete d[g[e].identifier],
e++;
return h.length ? [t(f.concat(h), 'identifier', !0), h] : void 0;
}
function R() {
x.apply(this, arguments);
var a = j(this.handler, this);
(this.touch = new P(this.manager, a)),
(this.mouse = new L(this.manager, a)),
(this.primaryTouch = null),
(this.lastTouches = []);
}
function S(a, b) {
a & Ea
? ((this.primaryTouch = b.changedPointers[0].identifier), T.call(this, b))
: a & (Ga | Ha) && T.call(this, b);
}
function T(a) {
var b = a.changedPointers[0];
if (b.identifier === this.primaryTouch) {
var c = { x: b.clientX, y: b.clientY };
this.lastTouches.push(c);
var d = this.lastTouches,
e = function() {
var a = d.indexOf(c);
a > -1 && d.splice(a, 1);
};
setTimeout(e, cb);
}
}
function U(a) {
for (
var b = a.srcEvent.clientX, c = a.srcEvent.clientY, d = 0;
d < this.lastTouches.length;
d++
) {
var e = this.lastTouches[d],
f = Math.abs(b - e.x),
g = Math.abs(c - e.y);
if (db >= f && db >= g) return !0;
}
return !1;
}
function V(a, b) {
(this.manager = a), this.set(b);
}
function W(a) {
if (p(a, jb)) return jb;
var b = p(a, kb),
c = p(a, lb);
return b && c ? jb : b || c ? (b ? kb : lb) : p(a, ib) ? ib : hb;
}
function X() {
if (!fb) return !1;
var b = {},
c = a.CSS && a.CSS.supports;
return (
['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(
function(d) {
b[d] = c ? a.CSS.supports('touch-action', d) : !0;
},
),
b
);
}
function Y(a) {
(this.options = la({}, this.defaults, a || {})),
(this.id = v()),
(this.manager = null),
(this.options.enable = l(this.options.enable, !0)),
(this.state = nb),
(this.simultaneous = {}),
(this.requireFail = []);
}
function Z(a) {
return a & sb
? 'cancel'
: a & qb
? 'end'
: a & pb
? 'move'
: a & ob
? 'start'
: '';
}
function $(a) {
return a == Ma
? 'down'
: a == La
? 'up'
: a == Ja
? 'left'
: a == Ka
? 'right'
: '';
}
function _(a, b) {
var c = b.manager;
return c ? c.get(a) : a;
}
function aa() {
Y.apply(this, arguments);
}
function ba() {
aa.apply(this, arguments), (this.pX = null), (this.pY = null);
}
function ca() {
aa.apply(this, arguments);
}
function da() {
Y.apply(this, arguments), (this._timer = null), (this._input = null);
}
function ea() {
aa.apply(this, arguments);
}
function fa() {
aa.apply(this, arguments);
}
function ga() {
Y.apply(this, arguments),
(this.pTime = !1),
(this.pCenter = !1),
(this._timer = null),
(this._input = null),
(this.count = 0);
}
function ha(a, b) {
return (
(b = b || {}),
(b.recognizers = l(b.recognizers, ha.defaults.preset)),
new ia(a, b)
);
}
function ia(a, b) {
(this.options = la({}, ha.defaults, b || {})),
(this.options.inputTarget = this.options.inputTarget || a),
(this.handlers = {}),
(this.session = {}),
(this.recognizers = []),
(this.oldCssProps = {}),
(this.element = a),
(this.input = y(this)),
(this.touchAction = new V(this, this.options.touchAction)),
ja(this, !0),
g(
this.options.recognizers,
function(a) {
var b = this.add(new a[0](a[1]));
a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]);
},
this,
);
}
function ja(a, b) {
var c = a.element;
if (c.style) {
var d;
g(a.options.cssProps, function(e, f) {
(d = u(c.style, f)),
b
? ((a.oldCssProps[d] = c.style[d]), (c.style[d] = e))
: (c.style[d] = a.oldCssProps[d] || '');
}),
b || (a.oldCssProps = {});
}
}
function ka(a, c) {
var d = b.createEvent('Event');
d.initEvent(a, !0, !0), (d.gesture = c), c.target.dispatchEvent(d);
}
var la,
ma = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'],
na = b.createElement('div'),
oa = 'function',
pa = Math.round,
qa = Math.abs,
ra = Date.now;
la =
'function' != typeof Object.assign
? function(a) {
if (a === d || null === a)
throw new TypeError('Cannot convert undefined or null to object');
for (var b = Object(a), c = 1; c < arguments.length; c++) {
var e = arguments[c];
if (e !== d && null !== e)
for (var f in e) e.hasOwnProperty(f) && (b[f] = e[f]);
}
return b;
}
: Object.assign;
var sa = h(
function(a, b, c) {
for (var e = Object.keys(b), f = 0; f < e.length; )
(!c || (c && a[e[f]] === d)) && (a[e[f]] = b[e[f]]), f++;
return a;
},
'extend',
'Use `assign`.',
),
ta = h(
function(a, b) {
return sa(a, b, !0);
},
'merge',
'Use `assign`.',
),
ua = 1,
va = /mobile|tablet|ip(ad|hone|od)|android/i,
wa = 'ontouchstart' in a,
xa = u(a, 'PointerEvent') !== d,
ya = wa && va.test(navigator.userAgent),
za = 'touch',
Aa = 'pen',
Ba = 'mouse',
Ca = 'kinect',
Da = 25,
Ea = 1,
Fa = 2,
Ga = 4,
Ha = 8,
Ia = 1,
Ja = 2,
Ka = 4,
La = 8,
Ma = 16,
Na = Ja | Ka,
Oa = La | Ma,
Pa = Na | Oa,
Qa = ['x', 'y'],
Ra = ['clientX', 'clientY'];
x.prototype = {
handler: function() {},
init: function() {
this.evEl && m(this.element, this.evEl, this.domHandler),
this.evTarget && m(this.target, this.evTarget, this.domHandler),
this.evWin && m(w(this.element), this.evWin, this.domHandler);
},
destroy: function() {
this.evEl && n(this.element, this.evEl, this.domHandler),
this.evTarget && n(this.target, this.evTarget, this.domHandler),
this.evWin && n(w(this.element), this.evWin, this.domHandler);
},
};
var Sa = { mousedown: Ea, mousemove: Fa, mouseup: Ga },
Ta = 'mousedown',
Ua = 'mousemove mouseup';
i(L, x, {
handler: function(a) {
var b = Sa[a.type];
b & Ea && 0 === a.button && (this.pressed = !0),
b & Fa && 1 !== a.which && (b = Ga),
this.pressed &&
(b & Ga && (this.pressed = !1),
this.callback(this.manager, b, {
pointers: [a],
changedPointers: [a],
pointerType: Ba,
srcEvent: a,
}));
},
});
var Va = {
pointerdown: Ea,
pointermove: Fa,
pointerup: Ga,
pointercancel: Ha,
pointerout: Ha,
},
Wa = { 2: za, 3: Aa, 4: Ba, 5: Ca },
Xa = 'pointerdown',
Ya = 'pointermove pointerup pointercancel';
a.MSPointerEvent &&
!a.PointerEvent &&
((Xa = 'MSPointerDown'),
(Ya = 'MSPointerMove MSPointerUp MSPointerCancel')),
i(M, x, {
handler: function(a) {
var b = this.store,
c = !1,
d = a.type.toLowerCase().replace('ms', ''),
e = Va[d],
f = Wa[a.pointerType] || a.pointerType,
g = f == za,
h = r(b, a.pointerId, 'pointerId');
e & Ea && (0 === a.button || g)
? 0 > h && (b.push(a), (h = b.length - 1))
: e & (Ga | Ha) && (c = !0),
0 > h ||
((b[h] = a),
this.callback(this.manager, e, {
pointers: b,
changedPointers: [a],
pointerType: f,
srcEvent: a,
}),
c && b.splice(h, 1));
},
});
var Za = { touchstart: Ea, touchmove: Fa, touchend: Ga, touchcancel: Ha },
$a = 'touchstart',
_a = 'touchstart touchmove touchend touchcancel';
i(N, x, {
handler: function(a) {
var b = Za[a.type];
if ((b === Ea && (this.started = !0), this.started)) {
var c = O.call(this, a, b);
b & (Ga | Ha) && c[0].length - c[1].length === 0 && (this.started = !1),
this.callback(this.manager, b, {
pointers: c[0],
changedPointers: c[1],
pointerType: za,
srcEvent: a,
});
}
},
});
var ab = { touchstart: Ea, touchmove: Fa, touchend: Ga, touchcancel: Ha },
bb = 'touchstart touchmove touchend touchcancel';
i(P, x, {
handler: function(a) {
var b = ab[a.type],
c = Q.call(this, a, b);
c &&
this.callback(this.manager, b, {
pointers: c[0],
changedPointers: c[1],
pointerType: za,
srcEvent: a,
});
},
});
var cb = 2500,
db = 25;
i(R, x, {
handler: function(a, b, c) {
var d = c.pointerType == za,
e = c.pointerType == Ba;
if (
!(e && c.sourceCapabilities && c.sourceCapabilities.firesTouchEvents)
) {
if (d) S.call(this, b, c);
else if (e && U.call(this, c)) return;
this.callback(a, b, c);
}
},
destroy: function() {
this.touch.destroy(), this.mouse.destroy();
},
});
var eb = u(na.style, 'touchAction'),
fb = eb !== d,
gb = 'compute',
hb = 'auto',
ib = 'manipulation',
jb = 'none',
kb = 'pan-x',
lb = 'pan-y',
mb = X();
V.prototype = {
set: function(a) {
a == gb && (a = this.compute()),
fb &&
this.manager.element.style &&
mb[a] &&
(this.manager.element.style[eb] = a),
(this.actions = a.toLowerCase().trim());
},
update: function() {
this.set(this.manager.options.touchAction);
},
compute: function() {
var a = [];
return (
g(this.manager.recognizers, function(b) {
k(b.options.enable, [b]) && (a = a.concat(b.getTouchAction()));
}),
W(a.join(' '))
);
},
preventDefaults: function(a) {
var b = a.srcEvent,
c = a.offsetDirection;
if (this.manager.session.prevented) return void b.preventDefault();
var d = this.actions,
e = p(d, jb) && !mb[jb],
f = p(d, lb) && !mb[lb],
g = p(d, kb) && !mb[kb];
if (e) {
var h = 1 === a.pointers.length,
i = a.distance < 2,
j = a.deltaTime < 250;
if (h && i && j) return;
}
return g && f
? void 0
: e || (f && c & Na) || (g && c & Oa)
? this.preventSrc(b)
: void 0;
},
preventSrc: function(a) {
(this.manager.session.prevented = !0), a.preventDefault();
},
};
var nb = 1,
ob = 2,
pb = 4,
qb = 8,
rb = qb,
sb = 16,
tb = 32;
(Y.prototype = {
defaults: {},
set: function(a) {
return (
la(this.options, a),
this.manager && this.manager.touchAction.update(),
this
);
},
recognizeWith: function(a) {
if (f(a, 'recognizeWith', this)) return this;
var b = this.simultaneous;
return (
(a = _(a, this)),
b[a.id] || ((b[a.id] = a), a.recognizeWith(this)),
this
);
},
dropRecognizeWith: function(a) {
return f(a, 'dropRecognizeWith', this)
? this
: ((a = _(a, this)), delete this.simultaneous[a.id], this);
},
requireFailure: function(a) {
if (f(a, 'requireFailure', this)) return this;
var b = this.requireFail;
return (
(a = _(a, this)),
-1 === r(b, a) && (b.push(a), a.requireFailure(this)),
this
);
},
dropRequireFailure: function(a) {
if (f(a, 'dropRequireFailure', this)) return this;
a = _(a, this);
var b = r(this.requireFail, a);
return b > -1 && this.requireFail.splice(b, 1), this;
},
hasRequireFailures: function() {
return this.requireFail.length > 0;
},
canRecognizeWith: function(a) {
return !!this.simultaneous[a.id];
},
emit: function(a) {
function b(b) {
c.manager.emit(b, a);
}
var c = this,
d = this.state;
qb > d && b(c.options.event + Z(d)),
b(c.options.event),
a.additionalEvent && b(a.additionalEvent),
d >= qb && b(c.options.event + Z(d));
},
tryEmit: function(a) {
return this.canEmit() ? this.emit(a) : void (this.state = tb);
},
canEmit: function() {
for (var a = 0; a < this.requireFail.length; ) {
if (!(this.requireFail[a].state & (tb | nb))) return !1;
a++;
}
return !0;
},
recognize: function(a) {
var b = la({}, a);
return k(this.options.enable, [this, b])
? (this.state & (rb | sb | tb) && (this.state = nb),
(this.state = this.process(b)),
void (this.state & (ob | pb | qb | sb) && this.tryEmit(b)))
: (this.reset(), void (this.state = tb));
},
process: function(a) {},
getTouchAction: function() {},
reset: function() {},
}),
i(aa, Y, {
defaults: { pointers: 1 },
attrTest: function(a) {
var b = this.options.pointers;
return 0 === b || a.pointers.length === b;
},
process: function(a) {
var b = this.state,
c = a.eventType,
d = b & (ob | pb),
e = this.attrTest(a);
return d && (c & Ha || !e)
? b | sb
: d || e
? c & Ga
? b | qb
: b & ob
? b | pb
: ob
: tb;
},
}),
i(ba, aa, {
defaults: { event: 'pan', threshold: 10, pointers: 1, direction: Pa },
getTouchAction: function() {
var a = this.options.direction,
b = [];
return a & Na && b.push(lb), a & Oa && b.push(kb), b;
},
directionTest: function(a) {
var b = this.options,
c = !0,
d = a.distance,
e = a.direction,
f = a.deltaX,
g = a.deltaY;
return (
e & b.direction ||
(b.direction & Na
? ((e = 0 === f ? Ia : 0 > f ? Ja : Ka),
(c = f != this.pX),
(d = Math.abs(a.deltaX)))
: ((e = 0 === g ? Ia : 0 > g ? La : Ma),
(c = g != this.pY),
(d = Math.abs(a.deltaY)))),
(a.direction = e),
c && d > b.threshold && e & b.direction
);
},
attrTest: function(a) {
return (
aa.prototype.attrTest.call(this, a) &&
(this.state & ob || (!(this.state & ob) && this.directionTest(a)))
);
},
emit: function(a) {
(this.pX = a.deltaX), (this.pY = a.deltaY);
var b = $(a.direction);
b && (a.additionalEvent = this.options.event + b),
this._super.emit.call(this, a);
},
}),
i(ca, aa, {
defaults: { event: 'pinch', threshold: 0, pointers: 2 },
getTouchAction: function() {
return [jb];
},
attrTest: function(a) {
return (
this._super.attrTest.call(this, a) &&
(Math.abs(a.scale - 1) > this.options.threshold || this.state & ob)
);
},
emit: function(a) {
if (1 !== a.scale) {
var b = a.scale < 1 ? 'in' : 'out';
a.additionalEvent = this.options.event + b;
}
this._super.emit.call(this, a);
},
}),
i(da, Y, {
defaults: { event: 'press', pointers: 1, time: 251, threshold: 9 },
getTouchAction: function() {
return [hb];
},
process: function(a) {
var b = this.options,
c = a.pointers.length === b.pointers,
d = a.distance < b.threshold,
f = a.deltaTime > b.time;
if (((this._input = a), !d || !c || (a.eventType & (Ga | Ha) && !f)))
this.reset();
else if (a.eventType & Ea)
this.reset(),
(this._timer = e(
function() {
(this.state = rb), this.tryEmit();
},
b.time,
this,
));
else if (a.eventType & Ga) return rb;
return tb;
},
reset: function() {
clearTimeout(this._timer);
},
emit: function(a) {
this.state === rb &&
(a && a.eventType & Ga
? this.manager.emit(this.options.event + 'up', a)
: ((this._input.timeStamp = ra()),
this.manager.emit(this.options.event, this._input)));
},
}),
i(ea, aa, {
defaults: { event: 'rotate', threshold: 0, pointers: 2 },
getTouchAction: function() {
return [jb];
},
attrTest: function(a) {
return (
this._super.attrTest.call(this, a) &&
(Math.abs(a.rotation) > this.options.threshold || this.state & ob)
);
},
}),
i(fa, aa, {
defaults: {
event: 'swipe',
threshold: 10,
velocity: 0.3,
direction: Na | Oa,
pointers: 1,
},
getTouchAction: function() {
return ba.prototype.getTouchAction.call(this);
},
attrTest: function(a) {
var b,
c = this.options.direction;
return (
c & (Na | Oa)
? (b = a.overallVelocity)
: c & Na
? (b = a.overallVelocityX)
: c & Oa && (b = a.overallVelocityY),
this._super.attrTest.call(this, a) &&
c & a.offsetDirection &&
a.distance > this.options.threshold &&
a.maxPointers == this.options.pointers &&
qa(b) > this.options.velocity &&
a.eventType & Ga
);
},
emit: function(a) {
var b = $(a.offsetDirection);
b && this.manager.emit(this.options.event + b, a),
this.manager.emit(this.options.event, a);
},
}),
i(ga, Y, {
defaults: {
event: 'tap',
pointers: 1,
taps: 1,
interval: 300,
time: 250,
threshold: 9,
posThreshold: 10,
},
getTouchAction: function() {
return [ib];
},
process: function(a) {
var b = this.options,
c = a.pointers.length === b.pointers,
d = a.distance < b.threshold,
f = a.deltaTime < b.time;
if ((this.reset(), a.eventType & Ea && 0 === this.count))
return this.failTimeout();
if (d && f && c) {
if (a.eventType != Ga) return this.failTimeout();
var g = this.pTime ? a.timeStamp - this.pTime < b.interval : !0,
h = !this.pCenter || H(this.pCenter, a.center) < b.posThreshold;
(this.pTime = a.timeStamp),
(this.pCenter = a.center),
h && g ? (this.count += 1) : (this.count = 1),
(this._input = a);
var i = this.count % b.taps;
if (0 === i)
return this.hasRequireFailures()
? ((this._timer = e(
function() {
(this.state = rb), this.tryEmit();
},
b.interval,
this,
)),
ob)
: rb;
}
return tb;
},
failTimeout: function() {
return (
(this._timer = e(
function() {
this.state = tb;
},
this.options.interval,
this,
)),
tb
);
},
reset: function() {
clearTimeout(this._timer);
},
emit: function() {
this.state == rb &&
((this._input.tapCount = this.count),
this.manager.emit(this.options.event, this._input));
},
}),
(ha.VERSION = '2.0.8'),
(ha.defaults = {
domEvents: !1,
touchAction: gb,
enable: !0,
inputTarget: null,
inputClass: null,
preset: [
[ea, { enable: !1 }],
[ca, { enable: !1 }, ['rotate']],
[fa, { direction: Na }],
[ba, { direction: Na }, ['swipe']],
[ga],
[ga, { event: 'doubletap', taps: 2 }, ['tap']],
[da],
],
cssProps: {
userSelect: 'none',
touchSelect: 'none',
touchCallout: 'none',
contentZooming: 'none',
userDrag: 'none',
tapHighlightColor: 'rgba(0,0,0,0)',
},
});
var ub = 1,
vb = 2;
(ia.prototype = {
set: function(a) {
return (
la(this.options, a),
a.touchAction && this.touchAction.update(),
a.inputTarget &&
(this.input.destroy(),
(this.input.target = a.inputTarget),
this.input.init()),
this
);
},
stop: function(a) {
this.session.stopped = a ? vb : ub;
},
recognize: function(a) {
var b = this.session;
if (!b.stopped) {
this.touchAction.preventDefaults(a);
var c,
d = this.recognizers,
e = b.curRecognizer;
(!e || (e && e.state & rb)) && (e = b.curRecognizer = null);
for (var f = 0; f < d.length; )
(c = d[f]),
b.stopped === vb || (e && c != e && !c.canRecognizeWith(e))
? c.reset()
: c.recognize(a),
!e && c.state & (ob | pb | qb) && (e = b.curRecognizer = c),
f++;
}
},
get: function(a) {
if (a instanceof Y) return a;
for (var b = this.recognizers, c = 0; c < b.length; c++)
if (b[c].options.event == a) return b[c];
return null;
},
add: function(a) {
if (f(a, 'add', this)) return this;
var b = this.get(a.options.event);
return (
b && this.remove(b),
this.recognizers.push(a),
(a.manager = this),
this.touchAction.update(),
a
);
},
remove: function(a) {
if (f(a, 'remove', this)) return this;
if ((a = this.get(a))) {
var b = this.recognizers,
c = r(b, a);
-1 !== c && (b.splice(c, 1), this.touchAction.update());
}
return this;
},
on: function(a, b) {
if (a !== d && b !== d) {
var c = this.handlers;
return (
g(q(a), function(a) {
(c[a] = c[a] || []), c[a].push(b);
}),
this
);
}
},
off: function(a, b) {
if (a !== d) {
var c = this.handlers;
return (
g(q(a), function(a) {
b ? c[a] && c[a].splice(r(c[a], b), 1) : delete c[a];
}),
this
);
}
},
emit: function(a, b) {
this.options.domEvents && ka(a, b);
var c = this.handlers[a] && this.handlers[a].slice();
if (c && c.length) {
(b.type = a),
(b.preventDefault = function() {
b.srcEvent.preventDefault();
});
for (var d = 0; d < c.length; ) c[d](b), d++;
}
},
destroy: function() {
this.element && ja(this, !1),
(this.handlers = {}),
(this.session = {}),
this.input.destroy(),
(this.element = null);
},
}),
la(ha, {
INPUT_START: Ea,
INPUT_MOVE: Fa,
INPUT_END: Ga,
INPUT_CANCEL: Ha,
STATE_POSSIBLE: nb,
STATE_BEGAN: ob,
STATE_CHANGED: pb,
STATE_ENDED: qb,
STATE_RECOGNIZED: rb,
STATE_CANCELLED: sb,
STATE_FAILED: tb,
DIRECTION_NONE: Ia,
DIRECTION_LEFT: Ja,
DIRECTION_RIGHT: Ka,
DIRECTION_UP: La,
DIRECTION_DOWN: Ma,
DIRECTION_HORIZONTAL: Na,
DIRECTION_VERTICAL: Oa,
DIRECTION_ALL: Pa,
Manager: ia,
Input: x,
TouchAction: V,
TouchInput: P,
MouseInput: L,
PointerEventInput: M,
TouchMouseInput: R,
SingleTouchInput: N,
Recognizer: Y,
AttrRecognizer: aa,
Tap: ga,
Pan: ba,
Swipe: fa,
Pinch: ca,
Rotate: ea,
Press: da,
on: m,
off: n,
each: g,
merge: ta,
extend: sa,
assign: la,
inherit: i,
bindFn: j,
prefixed: u,
});
var wb = 'undefined' != typeof a ? a : 'undefined' != typeof self ? self : {};
(wb.Hammer = ha),
'function' == typeof define && define.amd
? define(function() {
return ha;
})
: 'undefined' != typeof module && module.exports
? (module.exports = ha)
: (a[c] = ha);
})(window, document, 'Hammer');
//# sourceMappingURL=hammer.min.js.map
/*! iScroll v5.2.0-snapshot ~ (c) 2008-2019 Matteo Spinelli ~ http://cubiq.org/license */
!function(n,r,d){var m=n.requestAnimationFrame||n.webkitRequestAnimationFrame||n.mozRequestAnimationFrame||n.oRequestAnimationFrame||n.msRequestAnimationFrame||function(t){n.setTimeout(t,1e3/60)},f=function(){var e={},o=r.createElement("div").style,i=function(){for(var t=["t","webkitT","MozT","msT","OT"],i=0,s=t.length;i<s;i++)if(t[i]+"ransform"in o)return t[i].substr(0,t[i].length-1);return!1}();function t(t){return!1!==i&&(""===i?t:i+t.charAt(0).toUpperCase()+t.substr(1))}e.getTime=Date.now||function(){return(new Date).getTime()},e.extend=function(t,i){for(var s in i)t[s]=i[s]},e.addEvent=function(t,i,s,e){t.addEventListener(i,s,!!e)},e.removeEvent=function(t,i,s,e){t.removeEventListener(i,s,!!e)},e.prefixPointerEvent=function(t){return n.MSPointerEvent?"MSPointer"+t.charAt(7).toUpperCase()+t.substr(8):t},e.momentum=function(t,i,s,e,o,n){var r,h,a=t-i,l=d.abs(a)/s;return h=l/(n=void 0===n?6e-4:n),(r=t+l*l/(2*n)*(a<0?-1:1))<e?(r=o?e-o/2.5*(l/8):e,h=(a=d.abs(r-t))/l):0<r&&(r=o?o/2.5*(l/8):0,h=(a=d.abs(t)+r)/l),{destination:d.round(r),duration:h}};var s=t("transform");return e.extend(e,{hasTransform:!1!==s,hasPerspective:t("perspective")in o,hasTouch:"ontouchstart"in n,hasPointer:!(!n.PointerEvent&&!n.MSPointerEvent),hasTransition:t("transition")in o}),e.isBadAndroid=function(){var t=n.navigator.appVersion;if(!/Android/.test(t)||/Chrome\/\d/.test(t))return!1;var i=t.match(/Safari\/(\d+.\d)/);return!(i&&"object"==typeof i&&2<=i.length)||parseFloat(i[1])<535.19}(),e.extend(e.style={},{transform:s,transitionTimingFunction:t("transitionTimingFunction"),transitionDuration:t("transitionDuration"),transitionDelay:t("transitionDelay"),transformOrigin:t("transformOrigin"),touchAction:t("touchAction")}),e.hasClass=function(t,i){return new RegExp("(^|\\s)"+i+"(\\s|$)").test(t.className)},e.addClass=function(t,i){if(!e.hasClass(t,i)){var s=t.className.split(" ");s.push(i),t.className=s.join(" ")}},e.removeClass=function(t,i){if(e.hasClass(t,i)){var s=new RegExp("(^|\\s)"+i+"(\\s|$)","g");t.className=t.className.replace(s," ")}},e.offset=function(t){for(var i=-t.offsetLeft,s=-t.offsetTop;t=t.offsetParent;)i-=t.offsetLeft,s-=t.offsetTop;return{left:i,top:s}},e.preventDefaultException=function(t,i){for(var s in i)if(i[s].test(t[s]))return!0;return!1},e.extend(e.eventType={},{touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2,pointerdown:3,pointermove:3,pointerup:3,MSPointerDown:3,MSPointerMove:3,MSPointerUp:3}),e.extend(e.ease={},{quadratic:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},circular:{style:"cubic-bezier(0.1, 0.57, 0.1, 1)",fn:function(t){return d.sqrt(1- --t*t)}},back:{style:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",fn:function(t){return(t-=1)*t*(5*t+4)+1}},bounce:{style:"",fn:function(t){return(t/=1)<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}},elastic:{style:"",fn:function(t){return 0===t?0:1==t?1:.4*d.pow(2,-10*t)*d.sin((t-.055)*(2*d.PI)/.22)+1}}}),e.tap=function(t,i){var s=r.createEvent("Event");s.initEvent(i,!0,!0),s.pageX=t.pageX,s.pageY=t.pageY,t.target.dispatchEvent(s)},e.click=function(t){var i,s=t.target;/(SELECT|INPUT|TEXTAREA)/i.test(s.tagName)||((i=r.createEvent(n.MouseEvent?"MouseEvents":"Event")).initEvent("click",!0,!0),i.view=t.view||n,i.detail=1,i.screenX=s.screenX||0,i.screenY=s.screenY||0,i.clientX=s.clientX||0,i.clientY=s.clientY||0,i.ctrlKey=!!t.ctrlKey,i.altKey=!!t.altKey,i.shiftKey=!!t.shiftKey,i.metaKey=!!t.metaKey,i.button=0,i.relatedTarget=null,i._constructed=!0,s.dispatchEvent(i))},e.getTouchAction=function(t,i){var s="none";return"vertical"===t?s="pan-y":"horizontal"===t&&(s="pan-x"),i&&"none"!=s&&(s+=" pinch-zoom"),s},e.getRect=function(t){if("undefined"!=typeof SVGElement&&t instanceof SVGElement){var i=t.getBoundingClientRect();return{top:i.top,left:i.left,width:i.width,height:i.height}}return{top:t.offsetTop,left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight}},e}();function t(t,i){for(var s in this.wrapper="string"==typeof t?r.querySelector(t):t,this.scroller=this.wrapper.children[0],this.scrollerStyle=this.scroller.style,this.options={zoomMin:1,zoomMax:4,startZoom:1,resizeScrollbars:!0,mouseWheelSpeed:20,snapThreshold:.334,disablePointer:!f.hasPointer,disableTouch:f.hasPointer||!f.hasTouch,disableMouse:f.hasPointer||f.hasTouch,startX:0,startY:0,scrollY:!0,directionLockThreshold:5,momentum:!0,bounce:!0,bounceTime:600,bounceEasing:"",preventDefault:!0,preventDefaultException:{tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT)$/},HWCompositing:!0,useTransition:!0,useTransform:!0,bindToWrapper:void 0===n.onmousedown},i)this.options[s]=i[s];this.translateZ=this.options.HWCompositing&&f.hasPerspective?" translateZ(0)":"",this.options.useTransition=f.hasTransition&&this.options.useTransition,this.options.useTransform=f.hasTransform&&this.options.useTransform,this.options.eventPassthrough=!0===this.options.eventPassthrough?"vertical":this.options.eventPassthrough,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollY="vertical"!=this.options.eventPassthrough&&this.options.scrollY,this.options.scrollX="horizontal"!=this.options.eventPassthrough&&this.options.scrollX,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,this.options.bounceEasing="string"==typeof this.options.bounceEasing?f.ease[this.options.bounceEasing]||f.ease.circular:this.options.bounceEasing,this.options.resizePolling=void 0===this.options.resizePolling?60:this.options.resizePolling,!0===this.options.tap&&(this.options.tap="tap"),this.options.useTransition||this.options.useTransform||/relative|absolute/i.test(this.scrollerStyle.position)||(this.scrollerStyle.position="relative"),"scale"==this.options.shrinkScrollbars&&(this.options.useTransition=!1),this.options.invertWheelDirection=this.options.invertWheelDirection?-1:1,this.x=0,this.y=0,this.directionX=0,this.directionY=0,this._events={},this.scale=d.min(d.max(this.options.startZoom,this.options.zoomMin),this.options.zoomMax),this._init(),this.refresh(),this.scrollTo(this.options.startX,this.options.startY),this.enable()}function h(t,i,s){var e=r.createElement("div"),o=r.createElement("div");return!0===s&&(e.style.cssText="position:absolute;z-index:9999",o.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px"),o.className="iScrollIndicator","h"==t?(!0===s&&(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",o.style.height="100%"),e.className="iScrollHorizontalScrollbar"):(!0===s&&(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",o.style.width="100%"),e.className="iScrollVerticalScrollbar"),e.style.cssText+=";overflow:hidden",i||(e.style.pointerEvents="none"),e.appendChild(o),e}function a(t,i){for(var s in this.wrapper="string"==typeof i.el?r.querySelector(i.el):i.el,this.wrapperStyle=this.wrapper.style,this.indicator=this.wrapper.children[0],this.indicatorStyle=this.indicator.style,this.scroller=t,this.options={listenX:!0,listenY:!0,interactive:!1,resize:!0,defaultScrollbars:!1,shrink:!1,fade:!1,speedRatioX:0,speedRatioY:0},i)this.options[s]=i[s];if(this.sizeRatioX=1,this.sizeRatioY=1,this.maxPosX=0,this.maxPosY=0,this.options.interactive&&(this.options.disableTouch||(f.addEvent(this.indicator,"touchstart",this),f.addEvent(n,"touchend",this)),this.options.disablePointer||(f.addEvent(this.indicator,f.prefixPointerEvent("pointerdown"),this),f.addEvent(n,f.prefixPointerEvent("pointerup"),this)),this.options.disableMouse||(f.addEvent(this.indicator,"mousedown",this),f.addEvent(n,"mouseup",this))),this.options.fade){this.wrapperStyle[f.style.transform]=this.scroller.translateZ;var e=f.style.transitionDuration;if(!e)return;this.wrapperStyle[e]=f.isBadAndroid?"0.0001ms":"0ms";var o=this;f.isBadAndroid&&m(function(){"0.0001ms"===o.wrapperStyle[e]&&(o.wrapperStyle[e]="0s")}),this.wrapperStyle.opacity="0"}}t.prototype={version:"5.2.0-snapshot",_init:function(){this._initEvents(),this.options.zoom&&this._initZoom(),(this.options.scrollbars||this.options.indicators)&&this._initIndicators(),this.options.mouseWheel&&this._initWheel(),this.options.snap&&this._initSnap(),this.options.keyBindings&&this._initKeys()},destroy:function(){this._initEvents(!0),clearTimeout(this.resizeTimeout),this.resizeTimeout=null,this._execEvent("destroy")},_transitionEnd:function(t){t.target==this.scroller&&this.isInTransition&&(this._transitionTime(),this.resetPosition(this.options.bounceTime)||(this.isInTransition=!1,this._execEvent("scrollEnd")))},_start:function(t){if(1!=f.eventType[t.type]&&0!==(t.which?t.button:t.button<2?0:4==t.button?1:2))return;if(this.enabled&&(!this.initiated||f.eventType[t.type]===this.initiated)){!this.options.preventDefault||f.isBadAndroid||f.preventDefaultException(t.target,this.options.preventDefaultException)||t.preventDefault();var i,s=t.touches?t.touches[0]:t;this.initiated=f.eventType[t.type],this.moved=!1,this.distX=0,this.distY=0,this.directionX=0,this.directionY=0,this.directionLocked=0,this.startTime=f.getTime(),this.options.useTransition&&this.isInTransition?(this._transitionTime(),this.isInTransition=!1,i=this.getComputedPosition(),this._translate(d.round(i.x),d.round(i.y)),this._execEvent("scrollEnd")):!this.options.useTransition&&this.isAnimating&&(this.isAnimating=!1,this._execEvent("scrollEnd")),this.startX=this.x,this.startY=this.y,this.absStartX=this.x,this.absStartY=this.y,this.pointX=s.pageX,this.pointY=s.pageY,this._execEvent("beforeScrollStart")}},_move:function(t){if(this.enabled&&f.eventType[t.type]===this.initiated){this.options.preventDefault&&t.preventDefault();var i,s,e,o,n=t.touches?t.touches[0]:t,r=n.pageX-this.pointX,h=n.pageY-this.pointY,a=f.getTime();if(this.pointX=n.pageX,this.pointY=n.pageY,this.distX+=r,this.distY+=h,e=d.abs(this.distX),o=d.abs(this.distY),!(300<a-this.endTime&&e<10&&o<10)){if(this.directionLocked||this.options.freeScroll||(e>o+this.options.directionLockThreshold?this.directionLocked="h":o>=e+this.options.directionLockThreshold?this.directionLocked="v":this.directionLocked="n"),"h"==this.directionLocked){if("vertical"==this.options.eventPassthrough)t.preventDefault();else if("horizontal"==this.options.eventPassthrough)return void(this.initiated=!1);h=0}else if("v"==this.directionLocked){if("horizontal"==this.options.eventPassthrough)t.preventDefault();else if("vertical"==this.options.eventPassthrough)return void(this.initiated=!1);r=0}this.options.scrollX||(r=this.hasHorizontalScroll?r:0),this.options.scrollY||(h=this.hasVerticalScroll?h:0),i=this.x+r,s=this.y+h,(0<i||i<this.maxScrollX)&&(i=this.options.bounce?this.x+r/3:0<i?0:this.maxScrollX),(0<s||s<this.maxScrollY)&&(s=this.options.bounce?this.y+h/3:0<s?0:this.maxScrollY),this.directionX=0<r?-1:r<0?1:0,this.directionY=0<h?-1:h<0?1:0,this.moved||this._execEvent("scrollStart"),this.moved=!0,this._translate(i,s),300<a-this.startTime&&(this.startTime=a,this.startX=this.x,this.startY=this.y)}}},_end:function(t){if(this.enabled&&f.eventType[t.type]===this.initiated){this.options.preventDefault&&!f.preventDefaultException(t.target,this.options.preventDefaultException)&&t.preventDefault();t.changedTouches&&t.changedTouches[0];var i,s,e=f.getTime()-this.startTime,o=d.round(this.x),n=d.round(this.y),r=d.abs(o-this.startX),h=d.abs(n-this.startY),a=0,l="";if(this.isInTransition=0,this.initiated=0,this.endTime=f.getTime(),!this.resetPosition(this.options.bounceTime)){if(this.scrollTo(o,n),!this.moved)return this.options.tap&&f.tap(t,this.options.tap),this.options.click&&f.click(t),void this._execEvent("scrollCancel");if(this._events.flick&&e<200&&r<100&&h<100)this._execEvent("flick");else{if(this.options.momentum&&e<300&&(i=this.hasHorizontalScroll?f.momentum(this.x,this.startX,e,this.maxScrollX,this.options.bounce?this.wrapperWidth:0,this.options.deceleration):{destination:o,duration:0},s=this.hasVerticalScroll?f.momentum(this.y,this.startY,e,this.maxScrollY,this.options.bounce?this.wrapperHeight:0,this.options.deceleration):{destination:n,duration:0},o=i.destination,n=s.destination,a=d.max(i.duration,s.duration),this.isInTransition=1),this.options.snap){var c=this._nearestSnap(o,n);this.currentPage=c,a=this.options.snapSpeed||d.max(d.max(d.min(d.abs(o-c.x),1e3),d.min(d.abs(n-c.y),1e3)),300),o=c.x,n=c.y,this.directionX=0,this.directionY=0,l=this.options.bounceEasing}if(o!=this.x||n!=this.y)return(0<o||o<this.maxScrollX||0<n||n<this.maxScrollY)&&(l=f.ease.quadratic),void this.scrollTo(o,n,a,l);this._execEvent("scrollEnd")}}}},_resize:function(){var t=this;clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(function(){t.refresh()},this.options.resizePolling)},resetPosition:function(t){var i=this.x,s=this.y;return t=t||0,!this.hasHorizontalScroll||0<this.x?i=0:this.x<this.maxScrollX&&(i=this.maxScrollX),!this.hasVerticalScroll||0<this.y?s=0:this.y<this.maxScrollY&&(s=this.maxScrollY),(i!=this.x||s!=this.y)&&(this.scrollTo(i,s,t,this.options.bounceEasing),!0)},disable:function(){this.enabled=!1},enable:function(){this.enabled=!0},refresh:function(t){f.getRect(this.wrapper),this.wrapperWidth=this.wrapper.clientWidth,this.wrapperHeight=this.wrapper.clientHeight;var i=f.getRect(this.scroller);this.scrollerWidth=d.round(i.width*this.scale),this.scrollerHeight=d.round(i.height*this.scale),this.maxScrollX=this.wrapperWidth-this.scrollerWidth,this.maxScrollY=this.wrapperHeight-this.scrollerHeight,this.hasHorizontalScroll=this.options.scrollX&&this.maxScrollX<0,this.hasVerticalScroll=this.options.scrollY&&this.maxScrollY<0,this.hasHorizontalScroll||(this.maxScrollX=0,this.scrollerWidth=this.wrapperWidth),this.hasVerticalScroll||(this.maxScrollY=0,this.scrollerHeight=this.wrapperHeight),this.endTime=0,this.directionX=0,this.directionY=0,f.hasPointer&&!this.options.disablePointer&&(this.wrapper.style[f.style.touchAction]=f.getTouchAction(this.options.eventPassthrough,!0),this.wrapper.style[f.style.touchAction]||(this.wrapper.style[f.style.touchAction]=f.getTouchAction(this.options.eventPassthrough,!1))),this.wrapperOffset=f.offset(this.wrapper),this._execEvent("refresh"),this.resetPosition(t)},on:function(t,i){this._events[t]||(this._events[t]=[]),this._events[t].push(i)},off:function(t,i){if(this._events[t]){var s=this._events[t].indexOf(i);-1<s&&this._events[t].splice(s,1)}},_execEvent:function(t){if(this._events[t]){var i=0,s=this._events[t].length;if(s)for(;i<s;i++)this._events[t][i].apply(this,[].slice.call(arguments,1))}},scrollBy:function(t,i,s,e){t=this.x+t,i=this.y+i,s=s||0,this.scrollTo(t,i,s,e)},scrollTo:function(t,i,s,e){e=e||f.ease.circular,this.isInTransition=this.options.useTransition&&0<s;var o=this.options.useTransition&&e.style;!s||o?(o&&(this._transitionTimingFunction(e.style),this._transitionTime(s)),this._translate(t,i)):this._animate(t,i,s,e.fn)},scrollToElement:function(t,i,s,e,o){if(t=t.nodeType?t:this.scroller.querySelector(t)){var n=f.offset(t);n.left-=this.wrapperOffset.left,n.top-=this.wrapperOffset.top;var r=f.getRect(t),h=f.getRect(this.wrapper);!0===s&&(s=d.round(r.width/2-h.width/2)),!0===e&&(e=d.round(r.height/2-h.height/2)),n.left-=s||0,n.top-=e||0,n.left=0<n.left?0:n.left<this.maxScrollX?this.maxScrollX:n.left,n.top=0<n.top?0:n.top<this.maxScrollY?this.maxScrollY:n.top,i=null==i||"auto"===i?d.max(d.abs(this.x-n.left),d.abs(this.y-n.top)):i,this.scrollTo(n.left,n.top,i,o)}},_transitionTime:function(t){if(this.options.useTransition){t=t||0;var i=f.style.transitionDuration;if(i){if(this.scrollerStyle[i]=t+"ms",!t&&f.isBadAndroid){this.scrollerStyle[i]="0.0001ms";var s=this;m(function(){"0.0001ms"===s.scrollerStyle[i]&&(s.scrollerStyle[i]="0s")})}if(this.indicators)for(var e=this.indicators.length;e--;)this.indicators[e].transitionTime(t)}}},_transitionTimingFunction:function(t){if(this.scrollerStyle[f.style.transitionTimingFunction]=t,this.indicators)for(var i=this.indicators.length;i--;)this.indicators[i].transitionTimingFunction(t)},_translate:function(t,i){if(this.options.useTransform?this.scrollerStyle[f.style.transform]="translate("+t+"px,"+i+"px) scale("+this.scale+") "+this.translateZ:(t=d.round(t),i=d.round(i),this.scrollerStyle.left=t+"px",this.scrollerStyle.top=i+"px"),this.x=t,this.y=i,this.indicators)for(var s=this.indicators.length;s--;)this.indicators[s].updatePosition()},_initEvents:function(t){var i=t?f.removeEvent:f.addEvent,s=this.options.bindToWrapper?this.wrapper:n;i(n,"orientationchange",this),i(n,"resize",this),this.options.click&&i(this.wrapper,"click",this,!0),this.options.disableMouse||(i(this.wrapper,"mousedown",this),i(s,"mousemove",this),i(s,"mousecancel",this),i(s,"mouseup",this)),f.hasPointer&&!this.options.disablePointer&&(i(this.wrapper,f.prefixPointerEvent("pointerdown"),this),i(s,f.prefixPointerEvent("pointermove"),this),i(s,f.prefixPointerEvent("pointercancel"),this),i(s,f.prefixPointerEvent("pointerup"),this)),f.hasTouch&&!this.options.disableTouch&&(i(this.wrapper,"touchstart",this),i(s,"touchmove",this),i(s,"touchcancel",this),i(s,"touchend",this)),i(this.scroller,"transitionend",this),i(this.scroller,"webkitTransitionEnd",this),i(this.scroller,"oTransitionEnd",this),i(this.scroller,"MSTransitionEnd",this)},getComputedPosition:function(){var t,i,s=n.getComputedStyle(this.scroller,null);return i=this.options.useTransform?(t=+((s=s[f.style.transform].split(")")[0].split(", "))[12]||s[4]),+(s[13]||s[5])):(t=+s.left.replace(/[^-\d.]/g,""),+s.top.replace(/[^-\d.]/g,"")),{x:t,y:i}},_initIndicators:function(){var t,i=this.options.interactiveScrollbars,s="string"!=typeof this.options.scrollbars,e=[],o=this;this.indicators=[],this.options.scrollbars&&(this.options.scrollY&&(t={el:h("v",i,this.options.scrollbars),interactive:i,defaultScrollbars:!0,customStyle:s,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenX:!1},this.wrapper.appendChild(t.el),e.push(t)),this.options.scrollX&&(t={el:h("h",i,this.options.scrollbars),interactive:i,defaultScrollbars:!0,customStyle:s,resize:this.options.resizeScrollbars,shrink:this.options.shrinkScrollbars,fade:this.options.fadeScrollbars,listenY:!1},this.wrapper.appendChild(t.el),e.push(t))),this.options.indicators&&(e=e.concat(this.options.indicators));for(var n=e.length;n--;)this.indicators.push(new a(this,e[n]));function r(t){if(o.indicators)for(var i=o.indicators.length;i--;)t.call(o.indicators[i])}this.options.fadeScrollbars&&(this.on("scrollEnd",function(){r(function(){this.fade()})}),this.on("scrollCancel",function(){r(function(){this.fade()})}),this.on("scrollStart",function(){r(function(){this.fade(1)})}),this.on("beforeScrollStart",function(){r(function(){this.fade(1,!0)})})),this.on("refresh",function(){r(function(){this.refresh()})}),this.on("destroy",function(){r(function(){this.destroy()}),delete this.indicators})},_initZoom:function(){this.scrollerStyle[f.style.transformOrigin]="0 0"},_zoomStart:function(t){var i=d.abs(t.touches[0].pageX-t.touches[1].pageX),s=d.abs(t.touches[0].pageY-t.touches[1].pageY);this.touchesDistanceStart=d.sqrt(i*i+s*s),this.startScale=this.scale,this.originX=d.abs(t.touches[0].pageX+t.touches[1].pageX)/2+this.wrapperOffset.left-this.x,this.originY=d.abs(t.touches[0].pageY+t.touches[1].pageY)/2+this.wrapperOffset.top-this.y,this._execEvent("zoomStart")},_zoom:function(t){if(this.enabled&&f.eventType[t.type]===this.initiated){this.options.preventDefault&&t.preventDefault();var i,s,e,o=d.abs(t.touches[0].pageX-t.touches[1].pageX),n=d.abs(t.touches[0].pageY-t.touches[1].pageY),r=d.sqrt(o*o+n*n),h=1/this.touchesDistanceStart*r*this.startScale;this.scaled=!0,h<this.options.zoomMin?h=.5*this.options.zoomMin*d.pow(2,h/this.options.zoomMin):h>this.options.zoomMax&&(h=2*this.options.zoomMax*d.pow(.5,this.options.zoomMax/h)),i=h/this.startScale,s=this.originX-this.originX*i+this.startX,e=this.originY-this.originY*i+this.startY,this.scale=h,this.scrollTo(s,e,0)}},_zoomEnd:function(t){var i,s,e;this.enabled&&f.eventType[t.type]===this.initiated&&(this.options.preventDefault&&t.preventDefault(),this.isInTransition=0,this.initiated=0,this.scale>this.options.zoomMax?this.scale=this.options.zoomMax:this.scale<this.options.zoomMin&&(this.scale=this.options.zoomMin),this.refresh(),e=this.scale/this.startScale,i=this.originX-this.originX*e+this.startX,s=this.originY-this.originY*e+this.startY,0<i?i=0:i<this.maxScrollX&&(i=this.maxScrollX),0<s?s=0:s<this.maxScrollY&&(s=this.maxScrollY),this.scrollTo(i,s,this.options.bounceTime),this.scaled=!1,this._execEvent("zoomEnd"))},zoom:function(t,i,s,e){if(t<this.options.zoomMin?t=this.options.zoomMin:t>this.options.zoomMax&&(t=this.options.zoomMax),t!=this.scale){var o=t/this.scale;i=void 0===i?this.wrapperWidth/2-this.wrapperOffset.left:i,s=void 0===s?this.wrapperHeight/2-this.wrapperOffset.top:s,e=void 0===e?300:e,i=i+this.wrapperOffset.left-this.x,s=s+this.wrapperOffset.top-this.y,i=i-i*o+this.x,s=s-s*o+this.y,this.scale=t,this.refresh(),0<i?i=0:i<this.maxScrollX&&(i=this.maxScrollX),0<s?s=0:s<this.maxScrollY&&(s=this.maxScrollY),this.scrollTo(i,s,e)}},_wheelZoom:function(t){var i,s,e=this;if(clearTimeout(this.wheelTimeout),this.wheelTimeout=setTimeout(function(){e._execEvent("zoomEnd")},400),"deltaY"in t)i=-t.deltaY/d.abs(t.deltaY);else if("wheelDeltaY"in t)i=t.wheelDeltaY/d.abs(t.wheelDeltaY);else if("wheelDelta"in t)i=t.wheelDelta/d.abs(t.wheelDelta);else{if(!("detail"in t))return;i=-t.detail/d.abs(t.detail)}isNaN(i)&&(i=0),s=this.scale+.01*i,this.zoom(s,t.pageX,t.pageY,0),t.preventDefault(),t.stopPropagation()},_initWheel:function(){f.addEvent(this.wrapper,"wheel",this),f.addEvent(this.wrapper,"mousewheel",this),f.addEvent(this.wrapper,"DOMMouseScroll",this),this.on("destroy",function(){clearTimeout(this.wheelTimeout),this.wheelTimeout=null,f.removeEvent(this.wrapper,"wheel",this),f.removeEvent(this.wrapper,"mousewheel",this),f.removeEvent(this.wrapper,"DOMMouseScroll",this)})},_wheel:function(t){if(this.enabled){t.preventDefault();var i,s,e,o,n=this;if(void 0===this.wheelTimeout&&n._execEvent("scrollStart"),clearTimeout(this.wheelTimeout),this.wheelTimeout=setTimeout(function(){n.options.snap||n._execEvent("scrollEnd"),n.wheelTimeout=void 0},400),"deltaX"in t)s=1===t.deltaMode?(i=-t.deltaX*this.options.mouseWheelSpeed,-t.deltaY*this.options.mouseWheelSpeed):(i=-t.deltaX,-t.deltaY);else if("wheelDeltaX"in t)i=t.wheelDeltaX/120*this.options.mouseWheelSpeed,s=t.wheelDeltaY/120*this.options.mouseWheelSpeed;else if("wheelDelta"in t)i=s=t.wheelDelta/120*this.options.mouseWheelSpeed;else{if(!("detail"in t))return;i=s=-t.detail/3*this.options.mouseWheelSpeed}if(i*=this.options.invertWheelDirection,s*=this.options.invertWheelDirection,this.hasVerticalScroll||(i=s,s=0),this.options.snap)return e=this.currentPage.pageX,o=this.currentPage.pageY,0<i?e--:i<0&&e++,0<s?o--:s<0&&o++,void this.goToPage(e,o);e=this.x+d.round(this.hasHorizontalScroll?i:0),o=this.y+d.round(this.hasVerticalScroll?s:0),this.directionX=0<i?-1:i<0?1:0,this.directionY=0<s?-1:s<0?1:0,0<e?e=0:e<this.maxScrollX&&(e=this.maxScrollX),0<o?o=0:o<this.maxScrollY&&(o=this.maxScrollY),this.scrollTo(e,o,0)}},_initSnap:function(){this.currentPage={},"string"==typeof this.options.snap&&(this.options.snap=this.scroller.querySelectorAll(this.options.snap)),this.on("refresh",function(){var t,i,s,e,o,n,r,h=0,a=0,l=0,c=this.options.snapStepX||this.wrapperWidth,p=this.options.snapStepY||this.wrapperHeight;if(this.pages=[],this.wrapperWidth&&this.wrapperHeight&&this.scrollerWidth&&this.scrollerHeight){if(!0===this.options.snap)for(s=d.round(c/2),e=d.round(p/2);l>-this.scrollerWidth;){for(this.pages[h]=[],o=t=0;o>-this.scrollerHeight;)this.pages[h][t]={x:d.max(l,this.maxScrollX),y:d.max(o,this.maxScrollY),width:c,height:p,cx:l-s,cy:o-e},o-=p,t++;l-=c,h++}else for(t=(n=this.options.snap).length,i=-1;h<t;h++)r=f.getRect(n[h]),(0===h||r.left<=f.getRect(n[h-1]).left)&&(a=0,i++),this.pages[a]||(this.pages[a]=[]),l=d.max(-r.left,this.maxScrollX),o=d.max(-r.top,this.maxScrollY),s=l-d.round(r.width/2),e=o-d.round(r.height/2),this.pages[a][i]={x:l,y:o,width:r.width,height:r.height,cx:s,cy:e},l>this.maxScrollX&&a++;this.goToPage(this.currentPage.pageX||0,this.currentPage.pageY||0,0),this.options.snapThreshold%1==0?(this.snapThresholdX=this.options.snapThreshold,this.snapThresholdY=this.options.snapThreshold):(this.snapThresholdX=d.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].width*this.options.snapThreshold),this.snapThresholdY=d.round(this.pages[this.currentPage.pageX][this.currentPage.pageY].height*this.options.snapThreshold))}}),this.on("flick",function(){var t=this.options.snapSpeed||d.max(d.max(d.min(d.abs(this.x-this.startX),1e3),d.min(d.abs(this.y-this.startY),1e3)),300);this.goToPage(this.currentPage.pageX+this.directionX,this.currentPage.pageY+this.directionY,t)})},_nearestSnap:function(t,i){if(!this.pages.length)return{x:0,y:0,pageX:0,pageY:0};var s=0,e=this.pages.length,o=0;if(d.abs(t-this.absStartX)<this.snapThresholdX&&d.abs(i-this.absStartY)<this.snapThresholdY)return this.currentPage;for(0<t?t=0:t<this.maxScrollX&&(t=this.maxScrollX),0<i?i=0:i<this.maxScrollY&&(i=this.maxScrollY);s<e;s++)if(t>=this.pages[s][0].cx){t=this.pages[s][0].x;break}for(e=this.pages[s].length;o<e;o++)if(i>=this.pages[0][o].cy){i=this.pages[0][o].y;break}return s==this.currentPage.pageX&&((s+=this.directionX)<0?s=0:s>=this.pages.length&&(s=this.pages.length-1),t=this.pages[s][0].x),o==this.currentPage.pageY&&((o+=this.directionY)<0?o=0:o>=this.pages[0].length&&(o=this.pages[0].length-1),i=this.pages[0][o].y),{x:t,y:i,pageX:s,pageY:o}},goToPage:function(t,i,s,e){e=e||this.options.bounceEasing,t>=this.pages.length?t=this.pages.length-1:t<0&&(t=0),i>=this.pages[t].length?i=this.pages[t].length-1:i<0&&(i=0);var o=this.pages[t][i].x,n=this.pages[t][i].y;s=void 0===s?this.options.snapSpeed||d.max(d.max(d.min(d.abs(o-this.x),1e3),d.min(d.abs(n-this.y),1e3)),300):s,this.currentPage={x:o,y:n,pageX:t,pageY:i},this.scrollTo(o,n,s,e)},next:function(t,i){var s=this.currentPage.pageX,e=this.currentPage.pageY;++s>=this.pages.length&&this.hasVerticalScroll&&(s=0,e++),this.goToPage(s,e,t,i)},prev:function(t,i){var s=this.currentPage.pageX,e=this.currentPage.pageY;--s<0&&this.hasVerticalScroll&&(s=0,e--),this.goToPage(s,e,t,i)},_initKeys:function(t){var i,s={pageUp:33,pageDown:34,end:35,home:36,left:37,up:38,right:39,down:40};if("object"==typeof this.options.keyBindings)for(i in this.options.keyBindings)"string"==typeof this.options.keyBindings[i]&&(this.options.keyBindings[i]=this.options.keyBindings[i].toUpperCase().charCodeAt(0));else this.options.keyBindings={};for(i in s)this.options.keyBindings[i]=this.options.keyBindings[i]||s[i];f.addEvent(n,"keydown",this),this.on("destroy",function(){f.removeEvent(n,"keydown",this)})},_key:function(t){if(this.enabled){var i,s=this.options.snap,e=s?this.currentPage.pageX:this.x,o=s?this.currentPage.pageY:this.y,n=f.getTime(),r=this.keyTime||0;switch(this.options.useTransition&&this.isInTransition&&(i=this.getComputedPosition(),this._translate(d.round(i.x),d.round(i.y)),this.isInTransition=!1),this.keyAcceleration=n-r<200?d.min(this.keyAcceleration+.25,50):0,t.keyCode){case this.options.keyBindings.pageUp:this.hasHorizontalScroll&&!this.hasVerticalScroll?e+=s?1:this.wrapperWidth:o+=s?1:this.wrapperHeight;break;case this.options.keyBindings.pageDown:this.hasHorizontalScroll&&!this.hasVerticalScroll?e-=s?1:this.wrapperWidth:o-=s?1:this.wrapperHeight;break;case this.options.keyBindings.end:e=s?this.pages.length-1:this.maxScrollX,o=s?this.pages[0].length-1:this.maxScrollY;break;case this.options.keyBindings.home:o=e=0;break;case this.options.keyBindings.left:e+=s?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.up:o+=s?1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.right:e-=s?-1:5+this.keyAcceleration>>0;break;case this.options.keyBindings.down:o-=s?1:5+this.keyAcceleration>>0;break;default:return}s?this.goToPage(e,o):(0<e?(e=0,this.keyAcceleration=0):e<this.maxScrollX&&(e=this.maxScrollX,this.keyAcceleration=0),0<o?(o=0,this.keyAcceleration=0):o<this.maxScrollY&&(o=this.maxScrollY,this.keyAcceleration=0),this.scrollTo(e,o,0),this.keyTime=n)}},_animate:function(n,r,h,a){var l=this,c=this.x,p=this.y,d=f.getTime(),u=d+h;this.isAnimating=!0,function t(){var i,s,e,o=f.getTime();if(u<=o)return l.isAnimating=!1,l._translate(n,r),void(l.resetPosition(l.options.bounceTime)||l._execEvent("scrollEnd"));e=a(o=(o-d)/h),i=(n-c)*e+c,s=(r-p)*e+p,l._translate(i,s),l.isAnimating&&m(t)}()},handleEvent:function(t){switch(t.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(t),this.options.zoom&&t.touches&&1<t.touches.length&&this._zoomStart(t);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":if(this.options.zoom&&t.touches&&t.touches[1])return void this._zoom(t);this._move(t);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":if(this.scaled)return void this._zoomEnd(t);this._end(t);break;case"orientationchange":case"resize":this._resize();break;case"transitionend":case"webkitTransitionEnd":case"oTransitionEnd":case"MSTransitionEnd":this._transitionEnd(t);break;case"wheel":case"DOMMouseScroll":case"mousewheel":if("zoom"==this.options.wheelAction)return void this._wheelZoom(t);this._wheel(t);break;case"keydown":this._key(t)}}},a.prototype={handleEvent:function(t){switch(t.type){case"touchstart":case"pointerdown":case"MSPointerDown":case"mousedown":this._start(t);break;case"touchmove":case"pointermove":case"MSPointerMove":case"mousemove":this._move(t);break;case"touchend":case"pointerup":case"MSPointerUp":case"mouseup":case"touchcancel":case"pointercancel":case"MSPointerCancel":case"mousecancel":this._end(t)}},destroy:function(){this.options.fadeScrollbars&&(clearTimeout(this.fadeTimeout),this.fadeTimeout=null),this.options.interactive&&(f.removeEvent(this.indicator,"touchstart",this),f.removeEvent(this.indicator,f.prefixPointerEvent("pointerdown"),this),f.removeEvent(this.indicator,"mousedown",this),f.removeEvent(n,"touchmove",this),f.removeEvent(n,f.prefixPointerEvent("pointermove"),this),f.removeEvent(n,"mousemove",this),f.removeEvent(n,"touchend",this),f.removeEvent(n,f.prefixPointerEvent("pointerup"),this),f.removeEvent(n,"mouseup",this)),this.options.defaultScrollbars&&this.wrapper.parentNode&&this.wrapper.parentNode.removeChild(this.wrapper)},_start:function(t){var i=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.transitionTime(),this.initiated=!0,this.moved=!1,this.lastPointX=i.pageX,this.lastPointY=i.pageY,this.startTime=f.getTime(),this.options.disableTouch||f.addEvent(n,"touchmove",this),this.options.disablePointer||f.addEvent(n,f.prefixPointerEvent("pointermove"),this),this.options.disableMouse||f.addEvent(n,"mousemove",this),this.scroller._execEvent("beforeScrollStart")},_move:function(t){var i,s,e,o,n=t.touches?t.touches[0]:t;f.getTime();this.moved||this.scroller._execEvent("scrollStart"),this.moved=!0,i=n.pageX-this.lastPointX,this.lastPointX=n.pageX,s=n.pageY-this.lastPointY,this.lastPointY=n.pageY,e=this.x+i,o=this.y+s,this._pos(e,o),t.preventDefault(),t.stopPropagation()},_end:function(t){if(this.initiated){if(this.initiated=!1,t.preventDefault(),t.stopPropagation(),f.removeEvent(n,"touchmove",this),f.removeEvent(n,f.prefixPointerEvent("pointermove"),this),f.removeEvent(n,"mousemove",this),this.scroller.options.snap){var i=this.scroller._nearestSnap(this.scroller.x,this.scroller.y),s=this.options.snapSpeed||d.max(d.max(d.min(d.abs(this.scroller.x-i.x),1e3),d.min(d.abs(this.scroller.y-i.y),1e3)),300);this.scroller.x==i.x&&this.scroller.y==i.y||(this.scroller.directionX=0,this.scroller.directionY=0,this.scroller.currentPage=i,this.scroller.scrollTo(i.x,i.y,s,this.scroller.options.bounceEasing))}this.moved&&this.scroller._execEvent("scrollEnd")}},transitionTime:function(t){t=t||0;var i=f.style.transitionDuration;if(i&&(this.indicatorStyle[i]=t+"ms",!t&&f.isBadAndroid)){this.indicatorStyle[i]="0.0001ms";var s=this;m(function(){"0.0001ms"===s.indicatorStyle[i]&&(s.indicatorStyle[i]="0s")})}},transitionTimingFunction:function(t){this.indicatorStyle[f.style.transitionTimingFunction]=t},refresh:function(){this.transitionTime(),this.options.listenX&&!this.options.listenY?this.indicatorStyle.display=this.scroller.hasHorizontalScroll?"block":"none":this.options.listenY&&!this.options.listenX?this.indicatorStyle.display=this.scroller.hasVerticalScroll?"block":"none":this.indicatorStyle.display=this.scroller.hasHorizontalScroll||this.scroller.hasVerticalScroll?"block":"none",this.scroller.hasHorizontalScroll&&this.scroller.hasVerticalScroll?(f.addClass(this.wrapper,"iScrollBothScrollbars"),f.removeClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="8px":this.wrapper.style.bottom="8px")):(f.removeClass(this.wrapper,"iScrollBothScrollbars"),f.addClass(this.wrapper,"iScrollLoneScrollbar"),this.options.defaultScrollbars&&this.options.customStyle&&(this.options.listenX?this.wrapper.style.right="2px":this.wrapper.style.bottom="2px")),f.getRect(this.wrapper),this.options.listenX&&(this.wrapperWidth=this.wrapper.clientWidth,this.options.resize?(this.indicatorWidth=d.max(d.round(this.wrapperWidth*this.wrapperWidth/(this.scroller.scrollerWidth||this.wrapperWidth||1)),8),this.indicatorStyle.width=this.indicatorWidth+"px"):this.indicatorWidth=this.indicator.clientWidth,this.maxPosX=this.wrapperWidth-this.indicatorWidth,"clip"==this.options.shrink?(this.minBoundaryX=8-this.indicatorWidth,this.maxBoundaryX=this.wrapperWidth-8):(this.minBoundaryX=0,this.maxBoundaryX=this.maxPosX),this.sizeRatioX=this.options.speedRatioX||this.scroller.maxScrollX&&this.maxPosX/this.scroller.maxScrollX),this.options.listenY&&(this.wrapperHeight=this.wrapper.clientHeight,this.options.resize?(this.indicatorHeight=d.max(d.round(this.wrapperHeight*this.wrapperHeight/(this.scroller.scrollerHeight||this.wrapperHeight||1)),8),this.indicatorStyle.height=this.indicatorHeight+"px"):this.indicatorHeight=this.indicator.clientHeight,this.maxPosY=this.wrapperHeight-this.indicatorHeight,"clip"==this.options.shrink?(this.minBoundaryY=8-this.indicatorHeight,this.maxBoundaryY=this.wrapperHeight-8):(this.minBoundaryY=0,this.maxBoundaryY=this.maxPosY),this.maxPosY=this.wrapperHeight-this.indicatorHeight,this.sizeRatioY=this.options.speedRatioY||this.scroller.maxScrollY&&this.maxPosY/this.scroller.maxScrollY),this.updatePosition()},updatePosition:function(){var t=this.options.listenX&&d.round(this.sizeRatioX*this.scroller.x)||0,i=this.options.listenY&&d.round(this.sizeRatioY*this.scroller.y)||0;this.options.ignoreBoundaries||(t<this.minBoundaryX?("scale"==this.options.shrink&&(this.width=d.max(this.indicatorWidth+t,8),this.indicatorStyle.width=this.width+"px"),t=this.minBoundaryX):t>this.maxBoundaryX?t="scale"==this.options.shrink?(this.width=d.max(this.indicatorWidth-(t-this.maxPosX),8),this.indicatorStyle.width=this.width+"px",this.maxPosX+this.indicatorWidth-this.width):this.maxBoundaryX:"scale"==this.options.shrink&&this.width!=this.indicatorWidth&&(this.width=this.indicatorWidth,this.indicatorStyle.width=this.width+"px"),i<this.minBoundaryY?("scale"==this.options.shrink&&(this.height=d.max(this.indicatorHeight+3*i,8),this.indicatorStyle.height=this.height+"px"),i=this.minBoundaryY):i>this.maxBoundaryY?i="scale"==this.options.shrink?(this.height=d.max(this.indicatorHeight-3*(i-this.maxPosY),8),this.indicatorStyle.height=this.height+"px",this.maxPosY+this.indicatorHeight-this.height):this.maxBoundaryY:"scale"==this.options.shrink&&this.height!=this.indicatorHeight&&(this.height=this.indicatorHeight,this.indicatorStyle.height=this.height+"px")),this.x=t,this.y=i,this.scroller.options.useTransform?this.indicatorStyle[f.style.transform]="translate("+t+"px,"+i+"px)"+this.scroller.translateZ:(this.indicatorStyle.left=t+"px",this.indicatorStyle.top=i+"px")},_pos:function(t,i){t<0?t=0:t>this.maxPosX&&(t=this.maxPosX),i<0?i=0:i>this.maxPosY&&(i=this.maxPosY),t=this.options.listenX?d.round(t/this.sizeRatioX):this.scroller.x,i=this.options.listenY?d.round(i/this.sizeRatioY):this.scroller.y,this.scroller.scrollTo(t,i)},fade:function(t,i){if(!i||this.visible){clearTimeout(this.fadeTimeout),this.fadeTimeout=null;var s=t?250:500,e=t?0:300;t=t?"1":"0",this.wrapperStyle[f.style.transitionDuration]=s+"ms",this.fadeTimeout=setTimeout(function(t){this.wrapperStyle.opacity=t,this.visible=+t}.bind(this,t),e)}}},t.utils=f,"undefined"!=typeof module&&module.exports?module.exports=t:"function"==typeof define&&define.amd?define(function(){return t}):n.IScroll=t}(window,document,Math);
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,function(){return 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){n(6),n(7),e.exports=n(8)},function(e,t,n){(function(t){!function(n){function r(e,t){return function(){e.apply(t,arguments)}}function i(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],l(e,r(a,this),r(s,this))}function o(e){var t=this;return null===this._state?void this._deferreds.push(e):void f(function(){var n=t._state?e.onFulfilled:e.onRejected;if(null===n)return void(t._state?e.resolve:e.reject)(t._value);var r;try{r=n(t._value)}catch(i){return void e.reject(i)}e.resolve(r)})}function a(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void l(r(t,e),r(a,this),r(s,this))}this._state=!0,this._value=e,u.call(this)}catch(n){s.call(this,n)}}function s(e){this._state=!1,this._value=e,u.call(this)}function u(){for(var e=0,t=this._deferreds.length;t>e;e++)o.call(this,this._deferreds[e]);this._deferreds=null}function c(e,t,n,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r}function l(e,t,n){var r=!1;try{e(function(e){r||(r=!0,t(e))},function(e){r||(r=!0,n(e))})}catch(i){if(r)return;r=!0,n(i)}}var f="function"==typeof t&&t||function(e){setTimeout(e,1)},d=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};i.prototype["catch"]=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var n=this;return new i(function(r,i){o.call(n,new c(e,t,r,i))})},i.all=function(){var e=Array.prototype.slice.call(1===arguments.length&&d(arguments[0])?arguments[0]:arguments);return new i(function(t,n){function r(o,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(e){r(o,e)},n)}e[o]=a,0===--i&&t(e)}catch(u){n(u)}}if(0===e.length)return t([]);for(var i=e.length,o=0;o<e.length;o++)r(o,e[o])})},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i(function(t){t(e)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(e){return new i(function(t,n){for(var r=0,i=e.length;i>r;r++)e[r].then(t,n)})},i._setImmediateFn=function(e){f=e},i.prototype.always=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})})},"undefined"!=typeof e&&e.exports?e.exports=i:n.Promise||(n.Promise=i)}(this)}).call(t,n(2).setImmediate)},function(e,t,n){(function(e,r){function i(e,t){this._id=e,this._clearFn=t}var o=n(3).nextTick,a=Function.prototype.apply,s=Array.prototype.slice,u={},c=0;t.setTimeout=function(){return new i(a.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var n=c++,r=arguments.length<2?!1:s.call(arguments,1);return u[n]=!0,o(function(){u[n]&&(r?e.apply(null,r):e.call(null),t.clearImmediate(n))}),n},t.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(t,n(2).setImmediate,n(2).clearImmediate)},function(e,t){function n(){c=!1,a.length?u=a.concat(u):l=-1,u.length&&r()}function r(){if(!c){var e=setTimeout(n);c=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,c=!1,clearTimeout(e)}}function i(e,t){this.fun=e,this.array=t}function o(){}var a,s=e.exports={},u=[],c=!1,l=-1;s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new i(e,t)),1!==u.length||c||setTimeout(r,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=o,s.addListener=o,s.once=o,s.off=o,s.removeListener=o,s.removeAllListeners=o,s.emit=o,s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},function(e,t){function n(){var e=~navigator.userAgent.indexOf("Android")&&~navigator.vendor.indexOf("Google")&&!~navigator.userAgent.indexOf("Chrome");return e&&navigator.userAgent.match(/AppleWebKit\/(\d+)/).pop()<=534||/MQQBrowser/g.test(navigator.userAgent)}var r=function(){try{return new Blob,!0}catch(e){return!1}}()?window.Blob:function(e,t){var n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MSBlobBuilder||window.MozBlobBuilder);return e.forEach(function(e){n.append(e)}),n.getBlob(t?t.type:void 0)},i=function(){function e(){var e=this,n=[],i=Array(21).join("-")+(+new Date*(1e16*Math.random())).toString(36),o=XMLHttpRequest.prototype.send;this.getParts=function(){return n.toString()},this.append=function(e,t,r){n.push("--"+i+'\r\nContent-Disposition: form-data; name="'+e+'"'),t instanceof Blob?(n.push('; filename="'+(r||"blob")+'"\r\nContent-Type: '+t.type+"\r\n\r\n"),n.push(t)):n.push("\r\n\r\n"+t),n.push("\r\n")},t++,XMLHttpRequest.prototype.send=function(a){var s,u,c=this;a===e?(n.push("--"+i+"--\r\n"),u=new r(n),s=new FileReader,s.onload=function(){o.call(c,s.result)},s.onerror=function(e){throw e},s.readAsArrayBuffer(u),this.setRequestHeader("Content-Type","multipart/form-data; boundary="+i),t--,0==t&&(XMLHttpRequest.prototype.send=o)):o.call(this,a)}}var t=0;return e.prototype=Object.create(FormData.prototype),e}();e.exports={Blob:r,FormData:n()?i:FormData}},function(e,t,n){var r,i;(function(){function n(e){return!!e.exifdata}function o(e,t){t=t||e.match(/^data\:([^\;]+)\;base64,/im)[1]||"",e=e.replace(/^data\:([^\;]+)\;base64,/gim,"");for(var n=atob(e),r=n.length,i=new ArrayBuffer(r),o=new Uint8Array(i),a=0;r>a;a++)o[a]=n.charCodeAt(a);return i}function a(e,t){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="blob",n.onload=function(e){(200==this.status||0===this.status)&&t(this.response)},n.send()}function s(e,t){function n(n){var r=u(n),i=c(n);e.exifdata=r||{},e.iptcdata=i||{},t&&t.call(e)}if(e.src)if(/^data\:/i.test(e.src)){var r=o(e.src);n(r)}else if(/^blob\:/i.test(e.src)){var i=new FileReader;i.onload=function(e){n(e.target.result)},a(e.src,function(e){i.readAsArrayBuffer(e)})}else{var s=new XMLHttpRequest;s.onload=function(){200==this.status||0===this.status?n(s.response):t(new Error("Could not load image")),s=null},s.open("GET",e.src,!0),s.responseType="arraybuffer",s.send(null)}else if(window.FileReader&&(e instanceof window.Blob||e instanceof window.File)){var i=new FileReader;i.onload=function(e){p&&console.log("Got file of length "+e.target.result.byteLength),n(e.target.result)},i.readAsArrayBuffer(e)}}function u(e){var t=new DataView(e);if(p&&console.log("Got file of length "+e.byteLength),255!=t.getUint8(0)||216!=t.getUint8(1))return p&&console.log("Not a valid JPEG"),!1;for(var n,r=2,i=e.byteLength;i>r;){if(255!=t.getUint8(r))return p&&console.log("Not a valid marker at offset "+r+", found: "+t.getUint8(r)),!1;if(n=t.getUint8(r+1),p&&console.log(n),225==n)return p&&console.log("Found 0xFFE1 marker"),g(t,r+4,t.getUint16(r+2)-2);r+=2+t.getUint16(r+2)}}function c(e){var t=new DataView(e);if(p&&console.log("Got file of length "+e.byteLength),255!=t.getUint8(0)||216!=t.getUint8(1))return p&&console.log("Not a valid JPEG"),!1;for(var n=2,r=e.byteLength,i=function(e,t){return 56===e.getUint8(t)&&66===e.getUint8(t+1)&&73===e.getUint8(t+2)&&77===e.getUint8(t+3)&&4===e.getUint8(t+4)&&4===e.getUint8(t+5)};r>n;){if(i(t,n)){var o=t.getUint8(n+7);o%2!==0&&(o+=1),0===o&&(o=4);var a=n+8+o,s=t.getUint16(n+6+o);return l(e,a,s)}n++}}function l(e,t,n){for(var r,i,o,a,s,u=new DataView(e),c={},l=t;t+n>l;)28===u.getUint8(l)&&2===u.getUint8(l+1)&&(a=u.getUint8(l+2),a in S&&(o=u.getInt16(l+3),s=o+5,i=S[a],r=h(u,l+5,o),c.hasOwnProperty(i)?c[i]instanceof Array?c[i].push(r):c[i]=[c[i],r]:c[i]=r)),l++;return c}function f(e,t,n,r,i){var o,a,s,u=e.getUint16(n,!i),c={};for(s=0;u>s;s++)o=n+12*s+2,a=r[e.getUint16(o,!i)],!a&&p&&console.log("Unknown tag: "+e.getUint16(o,!i)),c[a]=d(e,o,t,n,i);return c}function d(e,t,n,r,i){var o,a,s,u,c,l,f=e.getUint16(t+2,!i),d=e.getUint32(t+4,!i),g=e.getUint32(t+8,!i)+n;switch(f){case 1:case 7:if(1==d)return e.getUint8(t+8,!i);for(o=d>4?g:t+8,a=[],u=0;d>u;u++)a[u]=e.getUint8(o+u);return a;case 2:return o=d>4?g:t+8,h(e,o,d-1);case 3:if(1==d)return e.getUint16(t+8,!i);for(o=d>2?g:t+8,a=[],u=0;d>u;u++)a[u]=e.getUint16(o+2*u,!i);return a;case 4:if(1==d)return e.getUint32(t+8,!i);for(a=[],u=0;d>u;u++)a[u]=e.getUint32(g+4*u,!i);return a;case 5:if(1==d)return c=e.getUint32(g,!i),l=e.getUint32(g+4,!i),s=new Number(c/l),s.numerator=c,s.denominator=l,s;for(a=[],u=0;d>u;u++)c=e.getUint32(g+8*u,!i),l=e.getUint32(g+4+8*u,!i),a[u]=new Number(c/l),a[u].numerator=c,a[u].denominator=l;return a;case 9:if(1==d)return e.getInt32(t+8,!i);for(a=[],u=0;d>u;u++)a[u]=e.getInt32(g+4*u,!i);return a;case 10:if(1==d)return e.getInt32(g,!i)/e.getInt32(g+4,!i);for(a=[],u=0;d>u;u++)a[u]=e.getInt32(g+8*u,!i)/e.getInt32(g+4+8*u,!i);return a}}function h(e,t,n){var r,i="";for(r=t;t+n>r;r++)i+=String.fromCharCode(e.getUint8(r));return i}function g(e,t){if("Exif"!=h(e,t,4))return p&&console.log("Not valid EXIF data! "+h(e,t,4)),!1;var n,r,i,o,a,s=t+6;if(18761==e.getUint16(s))n=!1;else{if(19789!=e.getUint16(s))return p&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;n=!0}if(42!=e.getUint16(s+2,!n))return p&&console.log("Not valid TIFF data! (no 0x002A)"),!1;var u=e.getUint32(s+4,!n);if(8>u)return p&&console.log("Not valid TIFF data! (First offset less than 8)",e.getUint32(s+4,!n)),!1;if(r=f(e,s,s+u,v,n),r.ExifIFDPointer){o=f(e,s,s+r.ExifIFDPointer,w,n);for(i in o){switch(i){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":o[i]=b[i][o[i]];break;case"ExifVersion":case"FlashpixVersion":o[i]=String.fromCharCode(o[i][0],o[i][1],o[i][2],o[i][3]);break;case"ComponentsConfiguration":o[i]=b.Components[o[i][0]]+b.Components[o[i][1]]+b.Components[o[i][2]]+b.Components[o[i][3]]}r[i]=o[i]}}if(r.GPSInfoIFDPointer){a=f(e,s,s+r.GPSInfoIFDPointer,y,n);for(i in a){switch(i){case"GPSVersionID":a[i]=a[i][0]+"."+a[i][1]+"."+a[i][2]+"."+a[i][3]}r[i]=a[i]}}return r}var p=!1,m=function(e){return e instanceof m?e:this instanceof m?void(this.EXIFwrapped=e):new m(e)};"undefined"!=typeof e&&e.exports&&(t=e.exports=m),t.EXIF=m;var w=m.Tags={36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubsecTime",37521:"SubsecTimeOriginal",37522:"SubsecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"ISOSpeedRatings",34856:"OECF",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRation",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",40965:"InteroperabilityIFDPointer",42016:"ImageUniqueID"},v=m.TiffTags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright"},y=m.GPSTags={0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential"},b=m.StringValues={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}},S={120:"caption",110:"credit",25:"keywords",55:"dateCreated",80:"byline",85:"bylineTitle",122:"captionWriter",105:"headline",116:"copyright",15:"category"};m.getData=function(e,t){return(e instanceof Image||e instanceof HTMLImageElement)&&!e.complete?!1:(n(e)?t&&t.call(e):s(e,t),!0)},m.getTag=function(e,t){return n(e)?e.exifdata[t]:void 0},m.getAllTags=function(e){if(!n(e))return{};var t,r=e.exifdata,i={};for(t in r)r.hasOwnProperty(t)&&(i[t]=r[t]);return i},m.pretty=function(e){if(!n(e))return"";var t,r=e.exifdata,i="";for(t in r)r.hasOwnProperty(t)&&(i+="object"==typeof r[t]?r[t]instanceof Number?t+" : "+r[t]+" ["+r[t].numerator+"/"+r[t].denominator+"]\r\n":t+" : ["+r[t].length+" values]\r\n":t+" : "+r[t]+"\r\n");return i},m.readFromBinaryFile=function(e){return u(e)},r=[],i=function(){return m}.apply(t,r),!(void 0!==i&&(e.exports=i))}).call(this)},function(e,t,n){var r,i;!function(){function n(e){var t=e.naturalWidth,n=e.naturalHeight;if(t*n>1048576){var r=document.createElement("canvas");r.width=r.height=1;var i=r.getContext("2d");return i.drawImage(e,-t+1,0),0===i.getImageData(0,0,1,1).data[3]}return!1}function o(e,t,n){var r=document.createElement("canvas");r.width=1,r.height=n;var i=r.getContext("2d");i.drawImage(e,0,0);for(var o=i.getImageData(0,0,1,n).data,a=0,s=n,u=n;u>a;){var c=o[4*(u-1)+3];0===c?s=u:a=u,u=s+a>>1}var l=u/n;return 0===l?1:l}function a(e,t,n){var r=document.createElement("canvas");return s(e,r,t,n),r.toDataURL("image/jpeg",t.quality||.8)}function s(e,t,r,i){var a=e.naturalWidth,s=e.naturalHeight,c=r.width,l=r.height,f=t.getContext("2d");f.save(),u(t,f,c,l,r.orientation);var d=n(e);d&&(a/=2,s/=2);var h=1024,g=document.createElement("canvas");g.width=g.height=h;for(var p=g.getContext("2d"),m=i?o(e,a,s):1,w=Math.ceil(h*c/a),v=Math.ceil(h*l/s/m),y=0,b=0;s>y;){for(var S=0,I=0;a>S;)p.clearRect(0,0,h,h),p.drawImage(e,-S,-y),f.drawImage(g,0,0,h,h,I,b,w,v),S+=h,I+=w;y+=h,b+=v}f.restore(),g=p=null}function u(e,t,n,r,i){switch(i){case 5:case 6:case 7:case 8:e.width=r,e.height=n;break;default:e.width=n,e.height=r}switch(i){case 2:t.translate(n,0),t.scale(-1,1);break;case 3:t.translate(n,r),t.rotate(Math.PI);break;case 4:t.translate(0,r),t.scale(1,-1);break;case 5:t.rotate(.5*Math.PI),t.scale(1,-1);break;case 6:t.rotate(.5*Math.PI),t.translate(0,-r);break;case 7:t.rotate(.5*Math.PI),t.translate(n,-r),t.scale(-1,1);break;case 8:t.rotate(-.5*Math.PI),t.translate(-n,0)}}function c(e){if(window.Blob&&e instanceof Blob){var t=new Image,n=window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;if(!n)throw Error("No createObjectURL function found to create blob url");t.src=n.createObjectURL(e),this.blob=e,e=t}if(!e.naturalWidth&&!e.naturalHeight){var r=this;e.onload=function(){var e=r.imageLoadListeners;if(e){r.imageLoadListeners=null;for(var t=0,n=e.length;n>t;t++)e[t]()}},this.imageLoadListeners=[]}this.srcImage=e}c.prototype.render=function(e,t,n){if(this.imageLoadListeners){var r=this;return void this.imageLoadListeners.push(function(){r.render(e,t,n)})}t=t||{};var i=this.srcImage,o=i.src,u=o.length,c=i.naturalWidth,l=i.naturalHeight,f=t.width,d=t.height,h=t.maxWidth,g=t.maxHeight,p=this.blob&&"image/jpeg"===this.blob.type||0===o.indexOf("data:image/jpeg")||o.indexOf(".jpg")===u-4||o.indexOf(".jpeg")===u-5;f&&!d?d=l*f/c<<0:d&&!f?f=c*d/l<<0:(f=c,d=l),h&&f>h&&(f=h,d=l*f/c<<0),g&&d>g&&(d=g,f=c*d/l<<0);var m={width:f,height:d};for(var w in t)m[w]=t[w];var v=e.tagName.toLowerCase();"img"===v?e.src=a(this.srcImage,m,p):"canvas"===v&&s(this.srcImage,e,m,p),"function"==typeof this.onrender&&this.onrender(e),n&&n()},r=[],i=function(){return c}.apply(t,r),!(void 0!==i&&(e.exports=i))}()},function(e,t){function n(e){function t(e){for(var t=[16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99],n=0;64>n;n++){var r=F((t[n]*e+50)/100);1>r?r=1:r>255&&(r=255),D[N[n]]=r}for(var i=[17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99],o=0;64>o;o++){var a=F((i[o]*e+50)/100);1>a?a=1:a>255&&(a=255),x[N[o]]=a}for(var s=[1,1.387039845,1.306562965,1.175875602,1,.785694958,.5411961,.275899379],u=0,c=0;8>c;c++)for(var l=0;8>l;l++)U[u]=1/(D[N[u]]*s[c]*s[l]*8),C[u]=1/(x[N[u]]*s[c]*s[l]*8),u++}function n(e,t){for(var n=0,r=0,i=new Array,o=1;16>=o;o++){for(var a=1;a<=e[o];a++)i[t[r]]=[],i[t[r]][0]=n,i[t[r]][1]=o,r++,n++;n*=2}return i}function r(){y=n(W,H),b=n(V,X),S=n(z,q),I=n(Q,Y)}function i(){for(var e=1,t=2,n=1;15>=n;n++){for(var r=e;t>r;r++)A[32767+r]=n,T[32767+r]=[],T[32767+r][1]=n,T[32767+r][0]=r;for(var i=-(t-1);-e>=i;i++)A[32767+i]=n,T[32767+i]=[],T[32767+i][1]=n,T[32767+i][0]=t-1+i;e<<=1,t<<=1}}function o(){for(var e=0;256>e;e++)k[e]=19595*e,k[e+256>>0]=38470*e,k[e+512>>0]=7471*e+32768,k[e+768>>0]=-11059*e,k[e+1024>>0]=-21709*e,k[e+1280>>0]=32768*e+8421375,k[e+1536>>0]=-27439*e,k[e+1792>>0]=-5329*e}function a(e){for(var t=e[0],n=e[1]-1;n>=0;)t&1<<n&&(G|=1<<O),n--,O--,0>O&&(255==G?(s(255),s(0)):s(G),O=7,G=0)}function s(e){M.push(j[e])}function u(e){s(e>>8&255),s(255&e)}function c(e,t){var n,r,i,o,a,s,u,c,l,f=0;const d=8,h=64;for(l=0;d>l;++l){n=e[f],r=e[f+1],i=e[f+2],o=e[f+3],a=e[f+4],s=e[f+5],u=e[f+6],c=e[f+7];var g=n+c,p=n-c,m=r+u,w=r-u,v=i+s,y=i-s,b=o+a,S=o-a,I=g+b,P=g-b,F=m+v,D=m-v;e[f]=I+F,e[f+4]=I-F;var x=.707106781*(D+P);e[f+2]=P+x,e[f+6]=P-x,I=S+y,F=y+w,D=w+p;var U=.382683433*(I-D),C=.5411961*I+U,T=1.306562965*D+U,A=.707106781*F,R=p+A,M=p-A;e[f+5]=M+C,e[f+3]=M-C,e[f+1]=R+T,e[f+7]=R-T,f+=8}for(f=0,l=0;d>l;++l){n=e[f],r=e[f+8],i=e[f+16],o=e[f+24],a=e[f+32],s=e[f+40],u=e[f+48],c=e[f+56];var G=n+c,O=n-c,_=r+u,B=r-u,E=i+s,j=i-s,k=o+a,N=o-a,W=G+k,H=G-k,z=_+E,q=_-E;e[f]=W+z,e[f+32]=W-z;var V=.707106781*(q+H);e[f+16]=H+V,e[f+48]=H-V,W=N+j,z=j+B,q=B+O;var X=.382683433*(W-q),Q=.5411961*W+X,Y=1.306562965*q+X,K=.707106781*z,J=O+K,Z=O-K;e[f+40]=Z+Q,e[f+24]=Z-Q,e[f+8]=J+Y,e[f+56]=J-Y,f++}var $;for(l=0;h>l;++l)$=e[l]*t[l],L[l]=$>0?$+.5|0:$-.5|0;return L}function l(){u(65504),u(16),s(74),s(70),s(73),s(70),s(0),s(1),s(1),s(0),u(1),u(1),s(0),s(0)}function f(e,t){u(65472),u(17),s(8),u(t),u(e),s(3),s(1),s(17),s(0),s(2),s(17),s(1),s(3),s(17),s(1)}function d(){u(65499),u(132),s(0);for(var e=0;64>e;e++)s(D[e]);s(1);for(var t=0;64>t;t++)s(x[t])}function h(){u(65476),u(418),s(0);for(var e=0;16>e;e++)s(W[e+1]);for(var t=0;11>=t;t++)s(H[t]);s(16);for(var n=0;16>n;n++)s(z[n+1]);for(var r=0;161>=r;r++)s(q[r]);s(1);for(var i=0;16>i;i++)s(V[i+1]);for(var o=0;11>=o;o++)s(X[o]);s(17);for(var a=0;16>a;a++)s(Q[a+1]);for(var c=0;161>=c;c++)s(Y[c])}function g(){u(65498),u(12),s(3),s(1),s(0),s(2),s(17),s(3),s(17),s(0),s(63),s(0)}function p(e,t,n,r,i){var o,s=i[0],u=i[240];const l=16,f=63,d=64;for(var h=c(e,t),g=0;d>g;++g)R[N[g]]=h[g];var p=R[0]-n;n=R[0],0==p?a(r[0]):(o=32767+p,a(r[A[o]]),a(T[o]));for(var m=63;m>0&&0==R[m];m--);if(0==m)return a(s),n;for(var w,v=1;m>=v;){for(var y=v;0==R[v]&&m>=v;++v);var b=v-y;if(b>=l){w=b>>4;for(var S=1;w>=S;++S)a(u);b=15&b}o=32767+R[v],a(i[(b<<4)+A[o]]),a(T[o]),v++}return m!=f&&a(s),n}function m(){for(var e=String.fromCharCode,t=0;256>t;t++)j[t]=e(t)}function w(e){if(0>=e&&(e=1),e>100&&(e=100),P!=e){var n=0;n=50>e?Math.floor(5e3/e):Math.floor(200-2*e),t(n),P=e}}function v(){var t=(new Date).getTime();e||(e=50),m(),r(),i(),o(),w(e);(new Date).getTime()-t}var y,b,S,I,P,F=(Math.round,Math.floor),D=new Array(64),x=new Array(64),U=new Array(64),C=new Array(64),T=new Array(65535),A=new Array(65535),L=new Array(64),R=new Array(64),M=[],G=0,O=7,_=new Array(64),B=new Array(64),E=new Array(64),j=new Array(256),k=new Array(2048),N=[0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63],W=[0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0],H=[0,1,2,3,4,5,6,7,8,9,10,11],z=[0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125],q=[1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,129,145,161,8,35,66,177,193,21,82,209,240,36,51,98,114,130,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,225,226,227,228,229,230,231,232,233,234,241,242,243,244,245,246,247,248,249,250],V=[0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0],X=[0,1,2,3,4,5,6,7,8,9,10,11],Q=[0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119],Y=[0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,129,8,20,66,145,161,177,193,9,35,51,82,240,21,98,114,209,10,22,36,52,225,37,241,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,130,131,132,133,134,135,136,137,138,146,147,148,149,150,151,152,153,154,162,163,164,165,166,167,168,169,170,178,179,180,181,182,183,184,185,186,194,195,196,197,198,199,200,201,202,210,211,212,213,214,215,216,217,218,226,227,228,229,230,231,232,233,234,242,243,244,245,246,247,248,249,250];this.encode=function(e,t,n){var r=(new Date).getTime();t&&w(t),M=new Array,G=0,O=7,u(65496),l(),d(),f(e.width,e.height),h(),g();var i=0,o=0,s=0;G=0,O=7,this.encode.displayName="_encode_";for(var c,m,v,P,F,D,x,T,A,L=e.data,R=e.width,j=e.height,N=4*R,W=0;j>W;){for(c=0;N>c;){for(F=N*W+c,D=F,x=-1,T=0,A=0;64>A;A++)T=A>>3,x=4*(7&A),D=F+T*N+x,W+T>=j&&(D-=N*(W+1+T-j)),c+x>=N&&(D-=c+x-N+4),m=L[D++],v=L[D++],P=L[D++],_[A]=(k[m]+k[v+256>>0]+k[P+512>>0]>>16)-128,B[A]=(k[m+768>>0]+k[v+1024>>0]+k[P+1280>>0]>>16)-128,E[A]=(k[m+1280>>0]+k[v+1536>>0]+k[P+1792>>0]>>16)-128;i=p(_,U,i,y,S),o=p(B,C,o,b,I),s=p(E,C,s,b,I),c+=32}W+=8}if(O>=0){var H=[];H[1]=O+1,H[0]=(1<<O+1)-1,a(H)}if(u(65497),n){for(var z=M.length,q=new Uint8Array(z),V=0;z>V;V++)q[V]=M[V].charCodeAt();M=[];(new Date).getTime()-r;return q}var X="data:image/jpeg;base64,"+btoa(M.join(""));M=[];(new Date).getTime()-r;return X},v()}e.exports=n},function(e,t,n){function r(e,t){var n=this;if(!e)throw new Error("没有收到图片,可能的解决方案:https://github.com/think2011/localResizeIMG/issues/7");t=t||{},n.defaults={width:null,height:null,fieldName:"file",quality:.7},n.file=e;for(var r in t)t.hasOwnProperty(r)&&(n.defaults[r]=t[r]);return this.init()}function i(e){var t=null;return t=e?[].filter.call(document.scripts,function(t){return-1!==t.src.indexOf(e)})[0]:document.scripts[document.scripts.length-1],t?t.src.substr(0,t.src.lastIndexOf("/")):null}function o(e){var t;t=e.split(",")[0].indexOf("base64")>=0?atob(e.split(",")[1]):unescape(e.split(",")[1]);for(var n=e.split(",")[0].split(":")[1].split(";")[0],r=new Uint8Array(t.length),i=0;i<t.length;i++)r[i]=t.charCodeAt(i);return new s.Blob([r.buffer],{type:n})}n.p=i("lrz")+"/",window.URL=window.URL||window.webkitURL;var a=n(1),s=n(4),u=n(5),c=function(e){var t=/OS (\d)_.* like Mac OS X/g.exec(e),n=/Android (\d.*?);/g.exec(e)||/Android\/(\d.*?) /g.exec(e);return{oldIOS:t?+t.pop()<8:!1,oldAndroid:n?+n.pop().substr(0,3)<4.5:!1,iOS:/\(i[^;]+;( U;)? CPU.+Mac OS X/.test(e),android:/Android/g.test(e),mQQBrowser:/MQQBrowser/g.test(e)}}(navigator.userAgent);r.prototype.init=function(){var e=this,t=e.file,n="string"==typeof t,r=/^data:/.test(t),i=new Image,u=document.createElement("canvas"),c=n?t:URL.createObjectURL(t);if(e.img=i,e.blob=c,e.canvas=u,n?e.fileName=r?"base64.jpg":t.split("/").pop():e.fileName=t.name,!document.createElement("canvas").getContext)throw new Error("浏览器不支持canvas");return new a(function(n,a){i.onerror=function(){var e=new Error("加载图片文件失败");throw a(e),e},i.onload=function(){e._getBase64().then(function(e){if(e.length<10){var t=new Error("生成base64失败");throw a(t),t}return e}).then(function(r){var i=null;"object"==typeof e.file&&r.length>e.file.size?(i=new FormData,t=e.file):(i=new s.FormData,t=o(r)),i.append(e.defaults.fieldName,t,e.fileName.replace(/\..+/g,".jpg")),n({formData:i,fileLen:+t.size,base64:r,base64Len:r.length,origin:e.file,file:t});for(var a in e)e.hasOwnProperty(a)&&(e[a]=null);URL.revokeObjectURL(e.blob)})},!r&&(i.crossOrigin="*"),i.src=c})},r.prototype._getBase64=function(){var e=this,t=e.img,n=e.file,r=e.canvas;return new a(function(i){try{u.getData("object"==typeof n?n:t,function(){e.orientation=u.getTag(this,"Orientation"),e.resize=e._getResize(),e.ctx=r.getContext("2d"),r.width=e.resize.width,r.height=e.resize.height,e.ctx.fillStyle="#fff",e.ctx.fillRect(0,0,r.width,r.height),c.oldIOS?e._createBase64ForOldIOS().then(i):e._createBase64().then(i)})}catch(o){throw new Error(o)}})},r.prototype._createBase64ForOldIOS=function(){var e=this,t=e.img,r=e.canvas,i=e.defaults,o=e.orientation;return new a(function(e){!function(){var a=[n(6)];(function(n){var a=new n(t);"5678".indexOf(o)>-1?a.render(r,{width:r.height,height:r.width,orientation:o}):a.render(r,{width:r.width,height:r.height,orientation:o}),e(r.toDataURL("image/jpeg",i.quality))}).apply(null,a)}()})},r.prototype._createBase64=function(){var e=this,t=e.resize,r=e.img,i=e.canvas,o=e.ctx,s=e.defaults,u=e.orientation;switch(u){case 3:o.rotate(180*Math.PI/180),o.drawImage(r,-t.width,-t.height,t.width,t.height);break;case 6:o.rotate(90*Math.PI/180),o.drawImage(r,0,-t.width,t.height,t.width);break;case 8:o.rotate(270*Math.PI/180),o.drawImage(r,-t.height,0,t.height,t.width);break;case 2:o.translate(t.width,0),o.scale(-1,1),o.drawImage(r,0,0,t.width,t.height);break;case 4:o.translate(t.width,0),o.scale(-1,1),o.rotate(180*Math.PI/180),o.drawImage(r,-t.width,-t.height,t.width,t.height);break;case 5:o.translate(t.width,0),o.scale(-1,1),o.rotate(90*Math.PI/180),o.drawImage(r,0,-t.width,t.height,t.width);break;case 7:o.translate(t.width,0),o.scale(-1,1),o.rotate(270*Math.PI/180),o.drawImage(r,-t.height,0,t.height,t.width);break;default:o.drawImage(r,0,0,t.width,t.height)}return new a(function(e){c.oldAndroid||c.mQQBrowser||!navigator.userAgent?!function(){var t=[n(7)];(function(t){var n=new t,r=o.getImageData(0,0,i.width,i.height);e(n.encode(r,100*s.quality))}).apply(null,t)}():e(i.toDataURL("image/jpeg",s.quality))})},r.prototype._getResize=function(){var e=this,t=e.img,n=e.defaults,r=n.width,i=n.height,o=e.orientation,a={width:t.width,height:t.height};if("5678".indexOf(o)>-1&&(a.width=t.height,a.height=t.width),a.width<r||a.height<i)return a;var s=a.width/a.height;for(r&&i?s>=r/i?a.width>r&&(a.width=r,a.height=Math.ceil(r/s)):a.height>i&&(a.height=i,a.width=Math.ceil(i*s)):r?r<a.width&&(a.width=r,a.height=Math.ceil(r/s)):i&&i<a.height&&(a.width=Math.ceil(i*s),a.height=i);a.width>=3264||a.height>=2448;)a.width*=.8,a.height*=.8;return a},window.lrz=function(e,t){return new r(e,t)},window.lrz.version="4.9.40",
e.exports=window.lrz}])});
//# sourceMappingURL=lrz.all.bundle.js.map
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论