From 70a104f24f3b3e3903d363081569be9af2052758 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 16 Jun 2020 07:32:55 +0000 Subject: =?UTF-8?q?up=C3=83date=20copperjs=20to=20version=201.5.7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/cropperjs/.eslintrc | 3 +- library/cropperjs/CHANGELOG.md | 5 + library/cropperjs/README.md | 25 +- library/cropperjs/dist/cropper.common.js | 70 +- library/cropperjs/dist/cropper.css | 4 +- library/cropperjs/dist/cropper.esm.js | 70 +- library/cropperjs/dist/cropper.js | 74 +- library/cropperjs/dist/cropper.min.css | 4 +- library/cropperjs/dist/cropper.min.js | 6 +- library/cropperjs/docs/css/cropper.css | 4 +- .../cropperjs/docs/examples/cropper-in-modal.html | 6 +- .../cropperjs/docs/examples/customize-preview.html | 6 + .../examples/upload-cropped-image-to-server.html | 6 +- library/cropperjs/docs/index.html | 22 +- library/cropperjs/docs/js/cropper.js | 74 +- library/cropperjs/karma.conf.js | 46 + library/cropperjs/package-lock.json | 11612 +++++++++++-------- library/cropperjs/package.json | 84 +- library/cropperjs/src/js/constants.js | 2 +- library/cropperjs/src/js/cropper.js | 2 +- library/cropperjs/src/js/handlers.js | 10 +- library/cropperjs/src/js/utilities.js | 2 +- library/cropperjs/test/karma.conf.js | 46 - 23 files changed, 6968 insertions(+), 5215 deletions(-) create mode 100644 library/cropperjs/karma.conf.js delete mode 100644 library/cropperjs/test/karma.conf.js (limited to 'library/cropperjs') diff --git a/library/cropperjs/.eslintrc b/library/cropperjs/.eslintrc index 7ecbe0dc0..e1ee964d5 100644 --- a/library/cropperjs/.eslintrc +++ b/library/cropperjs/.eslintrc @@ -1,10 +1,11 @@ { + "root": true, "extends": "airbnb-base", "env": { "browser": true }, - "root": true, "rules": { + "import/no-extraneous-dependencies": "off", "no-param-reassign": "off", "no-restricted-properties": "off", "valid-jsdoc": ["error", { diff --git a/library/cropperjs/CHANGELOG.md b/library/cropperjs/CHANGELOG.md index 5cddd4875..61bba7170 100644 --- a/library/cropperjs/CHANGELOG.md +++ b/library/cropperjs/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.5.7 (May 23, 2020) + +- Improve container resizing (#636). +- Improve touch device detection (#614). + ## 1.5.6 (Oct 4, 2019) - Improve event type determining for iOS 13+ (#571). diff --git a/library/cropperjs/README.md b/library/cropperjs/README.md index 6f1227f95..943db0b57 100644 --- a/library/cropperjs/README.md +++ b/library/cropperjs/README.md @@ -92,9 +92,12 @@ new Cropper(element[, options]) ``` ```css -/* Limit image width to avoid overflow the container */ +/* Ensure the size of the image fit the container perfectly */ img { - max-width: 100%; /* This rule is very important, please do not ignore this! */ + display: block; + + /* This rule is very important, please don't ignore this */ + max-width: 100%; } ``` @@ -258,7 +261,7 @@ Requires to set both the `rotatable` and `scalable` options to `true` at the sam **Note:** Don't trust this all the time as some JPG images have incorrect (not standard) Orientation values. -> Requires [Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) support ([IE 10+](http://caniuse.com/typedarrays)). +> Requires [Typed Arrays](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) support ([IE 10+](https://caniuse.com/typedarrays)). ### modal @@ -619,7 +622,7 @@ cropper.zoomTo(.5, { Rotate the image with a relative degree. -> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). +> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](https://caniuse.com/transforms2d)). ```js cropper.rotate(90); @@ -648,7 +651,7 @@ Rotate the image to an absolute degree. Scale the image. -> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). +> Requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](https://caniuse.com/transforms2d)). ```js cropper.scale(-1); // Flip both horizontal and vertical @@ -830,15 +833,15 @@ Change the crop box position and size with new data. - Uses the Browser's native [canvas.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) API to do the compression work, which means it is **lossy compression**. For better image quality, you can upload the original image and the cropped data to a server and do the crop work on the server. - Browser support: - - Basic image: requires [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) support ([IE 9+](http://caniuse.com/canvas)). - - Rotated image: requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](http://caniuse.com/transforms2d)). - - Cross-origin image: requires HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) support ([IE 11+](http://caniuse.com/cors)). + - Basic image: requires [Canvas](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement) support ([IE 9+](https://caniuse.com/canvas)). + - Rotated image: requires [CSS3 2D Transforms](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) support ([IE 9+](https://caniuse.com/transforms2d)). + - Cross-origin image: requires HTML5 [CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes) support ([IE 11+](https://caniuse.com/cors)). Get a canvas drawn the cropped image (lossy compression). If it is not cropped, then returns a canvas drawn the whole image. > After then, you can display the canvas as an image directly, or use [HTMLCanvasElement.toDataURL](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) to get a Data URL, or use [HTMLCanvasElement.toBlob](https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob) to get a blob and upload it to server with [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) if the browser supports these APIs. -Avoid to get a blank output image, you might need to set the `maxWidth` and `maxHeight` properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element). +Avoid to get a blank (or black) output image, you might need to set the `maxWidth` and `maxHeight` properties to limited numbers, because of [the size limits of a canvas element](https://stackoverflow.com/questions/6081483/maximum-size-of-a-canvas-element). Also, you should limit them maximum zoom ratio (in the `zoom` event) as the same reason. ```js cropper.getCroppedCanvas(); @@ -865,7 +868,7 @@ cropper.getCroppedCanvas().toBlob((blob) => { // Use `jQuery.ajax` method for example $.ajax('/path/to/upload', { - method: "POST", + method: 'POST', data: formData, processData: false, contentType: false, @@ -1049,7 +1052,7 @@ Maintained under the [Semantic Versioning guidelines](https://semver.org/). ## License -[MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com) +[MIT](https://opensource.org/licenses/MIT) © [Chen Fengyuan](https://chenfengyuan.com/) ## Related projects diff --git a/library/cropperjs/dist/cropper.common.js b/library/cropperjs/dist/cropper.common.js index 84cd77cdd..ca35bcf08 100644 --- a/library/cropperjs/dist/cropper.common.js +++ b/library/cropperjs/dist/cropper.common.js @@ -1,16 +1,18 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:48.372Z + * Date: 2020-05-23T05:23:00.081Z */ 'use strict'; function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; @@ -80,13 +82,13 @@ function _objectSpread2(target) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -96,28 +98,41 @@ function _objectSpread2(target) { } function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } + if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; } function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; var WINDOW = IS_BROWSER ? window : {}; -var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false; +var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false; var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; var NAMESPACE = 'cropper'; // Actions @@ -171,10 +186,6 @@ var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; var REGEXP_DATA_URL = /^data:/; var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc -// Inspired by the default width and height of a canvas element. - -var MIN_CONTAINER_WIDTH = 200; -var MIN_CONTAINER_HEIGHT = 100; var DEFAULTS = { // Define the view mode of the cropper @@ -382,7 +393,7 @@ var assign = Object.assign || function assign(target) { var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; /** * Normalize decimal number. - * Check out {@link http://0.30000000000000004.com/} + * Check out {@link https://0.30000000000000004.com/} * @param {number} value - The value to normalize. * @param {number} [times=100000000000] - The times for normalizing. * @returns {number} Returns the normalized number. @@ -1183,8 +1194,6 @@ function parseOrientation(orientation) { case 8: rotate = -90; break; - - default: } return { @@ -1789,16 +1798,13 @@ var events = { var handlers = { resize: function resize() { - var options = this.options, - container = this.container, - containerData = this.containerData; - var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH; - var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT; - - if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) { + if (this.disabled) { return; } + var options = this.options, + container = this.container, + containerData = this.containerData; var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed if (ratio !== 1 || container.offsetHeight !== containerData.height) { @@ -2046,8 +2052,6 @@ var change = { } break; - - default: } }; @@ -2412,8 +2416,6 @@ var change = { } break; - - default: } if (renderable) { @@ -3195,9 +3197,7 @@ var methods = { var AnotherCropper = WINDOW.Cropper; -var Cropper = -/*#__PURE__*/ -function () { +var Cropper = /*#__PURE__*/function () { /** * Create a new Cropper. * @param {Element} element - The target element for cropping. @@ -3246,7 +3246,7 @@ function () { if (!url) { return; - } // e.g.: "http://example.com/img/picture.jpg" + } // e.g.: "https://example.com/img/picture.jpg" url = element.src; diff --git a/library/cropperjs/dist/cropper.css b/library/cropperjs/dist/cropper.css index d54319a64..d914b48fd 100644 --- a/library/cropperjs/dist/cropper.css +++ b/library/cropperjs/dist/cropper.css @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:44.164Z + * Date: 2020-05-23T05:22:57.283Z */ .cropper-container { diff --git a/library/cropperjs/dist/cropper.esm.js b/library/cropperjs/dist/cropper.esm.js index 55bb43ec3..90f95c95b 100644 --- a/library/cropperjs/dist/cropper.esm.js +++ b/library/cropperjs/dist/cropper.esm.js @@ -1,14 +1,16 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:48.372Z + * Date: 2020-05-23T05:23:00.081Z */ function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; @@ -78,13 +80,13 @@ function _objectSpread2(target) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -94,28 +96,41 @@ function _objectSpread2(target) { } function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } + if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); +} + +function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); +} + +function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; } function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; var WINDOW = IS_BROWSER ? window : {}; -var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false; +var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false; var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; var NAMESPACE = 'cropper'; // Actions @@ -169,10 +184,6 @@ var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/; var REGEXP_DATA_URL = /^data:/; var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc -// Inspired by the default width and height of a canvas element. - -var MIN_CONTAINER_WIDTH = 200; -var MIN_CONTAINER_HEIGHT = 100; var DEFAULTS = { // Define the view mode of the cropper @@ -380,7 +391,7 @@ var assign = Object.assign || function assign(target) { var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; /** * Normalize decimal number. - * Check out {@link http://0.30000000000000004.com/} + * Check out {@link https://0.30000000000000004.com/} * @param {number} value - The value to normalize. * @param {number} [times=100000000000] - The times for normalizing. * @returns {number} Returns the normalized number. @@ -1181,8 +1192,6 @@ function parseOrientation(orientation) { case 8: rotate = -90; break; - - default: } return { @@ -1787,16 +1796,13 @@ var events = { var handlers = { resize: function resize() { - var options = this.options, - container = this.container, - containerData = this.containerData; - var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH; - var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT; - - if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) { + if (this.disabled) { return; } + var options = this.options, + container = this.container, + containerData = this.containerData; var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed if (ratio !== 1 || container.offsetHeight !== containerData.height) { @@ -2044,8 +2050,6 @@ var change = { } break; - - default: } }; @@ -2410,8 +2414,6 @@ var change = { } break; - - default: } if (renderable) { @@ -3193,9 +3195,7 @@ var methods = { var AnotherCropper = WINDOW.Cropper; -var Cropper = -/*#__PURE__*/ -function () { +var Cropper = /*#__PURE__*/function () { /** * Create a new Cropper. * @param {Element} element - The target element for cropping. @@ -3244,7 +3244,7 @@ function () { if (!url) { return; - } // e.g.: "http://example.com/img/picture.jpg" + } // e.g.: "https://example.com/img/picture.jpg" url = element.src; diff --git a/library/cropperjs/dist/cropper.js b/library/cropperjs/dist/cropper.js index 5c49d7bdf..9bed97a52 100644 --- a/library/cropperjs/dist/cropper.js +++ b/library/cropperjs/dist/cropper.js @@ -1,20 +1,22 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:48.372Z + * Date: 2020-05-23T05:23:00.081Z */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, global.Cropper = factory()); -}(this, function () { 'use strict'; +}(this, (function () { 'use strict'; function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function (obj) { return typeof obj; @@ -84,13 +86,13 @@ var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { - ownKeys(source, true).forEach(function (key) { + ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { - ownKeys(source).forEach(function (key) { + ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } @@ -100,28 +102,41 @@ } function _toConsumableArray(arr) { - return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); + return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { - if (Array.isArray(arr)) { - for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; - - return arr2; - } + if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { - if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); + if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(o); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; } function _nonIterableSpread() { - throw new TypeError("Invalid attempt to spread non-iterable instance"); + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined'; var WINDOW = IS_BROWSER ? window : {}; - var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false; + var IS_TOUCH_DEVICE = IS_BROWSER && WINDOW.document.documentElement ? 'ontouchstart' in WINDOW.document.documentElement : false; var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false; var NAMESPACE = 'cropper'; // Actions @@ -175,10 +190,6 @@ var REGEXP_DATA_URL = /^data:/; var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/; var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc - // Inspired by the default width and height of a canvas element. - - var MIN_CONTAINER_WIDTH = 200; - var MIN_CONTAINER_HEIGHT = 100; var DEFAULTS = { // Define the view mode of the cropper @@ -386,7 +397,7 @@ var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/; /** * Normalize decimal number. - * Check out {@link http://0.30000000000000004.com/} + * Check out {@link https://0.30000000000000004.com/} * @param {number} value - The value to normalize. * @param {number} [times=100000000000] - The times for normalizing. * @returns {number} Returns the normalized number. @@ -1187,8 +1198,6 @@ case 8: rotate = -90; break; - - default: } return { @@ -1793,16 +1802,13 @@ var handlers = { resize: function resize() { - var options = this.options, - container = this.container, - containerData = this.containerData; - var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH; - var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT; - - if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) { + if (this.disabled) { return; } + var options = this.options, + container = this.container, + containerData = this.containerData; var ratio = container.offsetWidth / containerData.width; // Resize when width changed or height changed if (ratio !== 1 || container.offsetHeight !== containerData.height) { @@ -2050,8 +2056,6 @@ } break; - - default: } }; @@ -2416,8 +2420,6 @@ } break; - - default: } if (renderable) { @@ -3199,9 +3201,7 @@ var AnotherCropper = WINDOW.Cropper; - var Cropper = - /*#__PURE__*/ - function () { + var Cropper = /*#__PURE__*/function () { /** * Create a new Cropper. * @param {Element} element - The target element for cropping. @@ -3250,7 +3250,7 @@ if (!url) { return; - } // e.g.: "http://example.com/img/picture.jpg" + } // e.g.: "https://example.com/img/picture.jpg" url = element.src; @@ -3613,4 +3613,4 @@ return Cropper; -})); +}))); diff --git a/library/cropperjs/dist/cropper.min.css b/library/cropperjs/dist/cropper.min.css index d870a6740..6bdccb8ad 100644 --- a/library/cropperjs/dist/cropper.min.css +++ b/library/cropperjs/dist/cropper.min.css @@ -1,9 +1,9 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:44.164Z + * Date: 2020-05-23T05:22:57.283Z */.cropper-container{direction:ltr;font-size:0;line-height:0;position:relative;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.cropper-container img{display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:" ";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}@media (min-width:768px){.cropper-point.point-se{height:15px;width:15px}}@media (min-width:992px){.cropper-point.point-se{height:10px;width:10px}}@media (min-width:1200px){.cropper-point.point-se{height:5px;opacity:.75;width:5px}}.cropper-point.point-se:before{background-color:#39f;bottom:-50%;content:" ";display:block;height:200%;opacity:0;position:absolute;right:-50%;width:200%}.cropper-invisible{opacity:0}.cropper-bg{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed} \ No newline at end of file diff --git a/library/cropperjs/dist/cropper.min.js b/library/cropperjs/dist/cropper.min.js index 958cc2391..6896c806b 100644 --- a/library/cropperjs/dist/cropper.min.js +++ b/library/cropperjs/dist/cropper.min.js @@ -1,10 +1,10 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:48.372Z + * Date: 2020-05-23T05:23:00.081Z */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Cropper=e()}(this,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var i=0;it.width?3===i?h=t.height*r:s=t.width/r:3===i?s=t.width/r:h=t.height*r;var c={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:h,height:s};c.left=(t.width-h)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=ht({},e),this.initialCanvasData=ht({},c)},limitCanvas:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=i.viewMode,h=n.aspectRatio,s=this.cropped&&o;if(t){var c=Number(i.minCanvasWidth)||0,l=Number(i.minCanvasHeight)||0;1=a.width&&(n.minLeft=Math.min(0,p),n.maxLeft=Math.max(0,p)),n.height>=a.height&&(n.minTop=Math.min(0,u),n.maxTop=Math.max(0,u))))}else n.minLeft=-n.width,n.minTop=-n.height,n.maxLeft=a.width,n.maxTop=a.height},renderCanvas:function(t,e){var i=this.canvasData,a=this.imageData;if(e){var n=function(t){var e=t.width,i=t.height,a=t.degree;if(90===(a=Math.abs(a)%180))return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),h=e*r+i*o,s=e*o+i*r;return 90i.maxWidth||i.widthi.maxHeight||i.heighte.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=ht({},n)},limitCropBox:function(t,e){var i=this.options,a=this.containerData,n=this.canvasData,o=this.cropBoxData,r=this.limited,h=i.aspectRatio;if(t){var s=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,l=r?Math.min(a.width,n.width,n.width+n.left,a.width-n.left):a.width,d=r?Math.min(a.height,n.height,n.height+n.top,a.height-n.top):a.height;s=Math.min(s,a.width),c=Math.min(c,a.height),h&&(s&&c?si.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?k:D),dt(this.cropBox,ht({width:i.width,height:i.height},Et({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ct(this.element,b,this.getData())}},Xt={initPreview:function(){var t=this.element,i=this.crossOrigin,e=this.options.preview,a=i?this.crossOriginUrl:this.url,n=t.alt||"The image to preview",o=document.createElement("img");if(i&&(o.crossOrigin=i),o.src=a,o.alt=n,this.viewBox.appendChild(o),this.viewBoxImage=o,e){var r=e;"string"==typeof e?r=t.ownerDocument.querySelectorAll(e):e.querySelector&&(r=[e]),rt(this.previews=r,function(t){var e=document.createElement("img");wt(t,g,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),i&&(e.crossOrigin=i),e.src=a,e.alt=n,e.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(e)})}},resetPreview:function(){rt(this.previews,function(t){var e=vt(t,g);dt(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(e,i){if(tt(e[i]))try{delete e[i]}catch(t){e[i]=void 0}else if(e.dataset)try{delete e.dataset[i]}catch(t){e.dataset[i]=void 0}else e.removeAttribute("data-".concat(ft(i)))}(t,g)})},preview:function(){var h=this.imageData,t=this.canvasData,e=this.cropBoxData,s=e.width,c=e.height,l=h.width,d=h.height,p=e.left-t.left-h.left,u=e.top-t.top-h.top;this.cropped&&!this.disabled&&(dt(this.viewBoxImage,ht({width:l,height:d},Et(ht({translateX:-p,translateY:-u},h)))),rt(this.previews,function(t){var e=vt(t,g),i=e.width,a=e.height,n=i,o=a,r=1;s&&(o=c*(r=i/s)),c&&av&&(M.x=v-u);break;case E:c+M.xw&&(M.y=w-m)}}var y=r[Object.keys(r)[0]],M={x:y.endX-y.startX,y:y.endY-y.startY};switch(h){case D:c+=M.x,l+=M.y;break;case T:if(0<=M.x&&(v<=u||s&&(l<=f||w<=m))){b=!1;break}x(T),(d+=M.x)<0&&(h=E,c-=d=-d),s&&(p=d/s,l+=(o.height-p)/2);break;case N:if(M.y<=0&&(l<=f||s&&(c<=g||v<=u))){b=!1;break}x(N),p-=M.y,l+=M.y,p<0&&(h=W,l-=p=-p),s&&(d=p*s,c+=(o.width-d)/2);break;case E:if(M.x<=0&&(c<=g||s&&(l<=f||w<=m))){b=!1;break}x(E),d-=M.x,c+=M.x,d<0&&(h=T,c-=d=-d),s&&(p=d/s,l+=(o.height-p)/2);break;case W:if(0<=M.y&&(w<=m||s&&(c<=g||v<=u))){b=!1;break}x(W),(p+=M.y)<0&&(h=N,l-=p=-p),s&&(d=p*s,c+=(o.width-d)/2);break;case H:if(s){if(M.y<=0&&(l<=f||v<=u)){b=!1;break}x(N),p-=M.y,l+=M.y,d=p*s}else x(N),x(T),0<=M.x?u or element.");this.element=t,this.options=ht({},G,it(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}return function(t,e,i){e&&a(t.prototype,e),i&&a(t,i)}(i,[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[l]){if(e[l]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",!(this.originalUrl=t))return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,a=this.options;if(a.rotatable||a.scalable||(a.checkOrientation=!1),a.checkOrientation&&window.ArrayBuffer)if(Q.test(t))K.test(t)?this.read(function(t){var e=t.replace(Lt,""),i=atob(e),a=new ArrayBuffer(i.length),n=new Uint8Array(a);return rt(n,function(t,e){n[e]=i.charCodeAt(e)}),a}(t)):this.clone();else{var n=new XMLHttpRequest,o=this.clone.bind(this);this.reloading=!0,(this.xhr=n).onabort=o,n.onerror=o,n.ontimeout=o,n.onprogress=function(){n.getResponseHeader("content-type")!==q&&n.abort()},n.onload=function(){e.read(n.response)},n.onloadend=function(){e.reloading=!1,e.xhr=null},a.checkCrossOrigin&&Ot(t)&&i.crossOrigin&&(t=Tt(t)),n.open("GET",t),n.responseType="arraybuffer",n.withCredentials="use-credentials"===i.crossOrigin,n.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,a=zt(t),n=0,o=1,r=1;if(1
';var o=n.querySelector(".".concat(l,"-container")),r=o.querySelector(".".concat(l,"-canvas")),h=o.querySelector(".".concat(l,"-drag-box")),s=o.querySelector(".".concat(l,"-crop-box")),c=s.querySelector(".".concat(l,"-face"));this.container=a,this.cropper=o,this.canvas=r,this.dragBox=h,this.cropBox=s,this.viewBox=o.querySelector(".".concat(l,"-view-box")),this.face=c,r.appendChild(i),pt(t,X),a.insertBefore(o,t.nextSibling),this.isImg||ut(i,d),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,pt(s,X),e.guides||pt(s.getElementsByClassName("".concat(l,"-dashed")),X),e.center||pt(s.getElementsByClassName("".concat(l,"-center")),X),e.background&&pt(o,"".concat(l,"-bg")),e.highlight||pt(c,p),e.cropBoxMovable&&(pt(c,u),wt(c,m,D)),e.cropBoxResizable||(pt(s.getElementsByClassName("".concat(l,"-line")),X),pt(s.getElementsByClassName("".concat(l,"-point")),X)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),at(e.ready)&&Mt(t,I,e.ready,{once:!0}),Ct(t,I)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),ut(this.element,X))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],[{key:"noConflict",value:function(){return window.Cropper=Pt,i}},{key:"setDefaults",value:function(t){ht(G,it(t)&&t)}}]),i}();return ht(It.prototype,Yt,Xt,Rt,St,At,jt),It}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Cropper=e()}(this,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t,e){for(var i=0;it.length)&&(e=t.length);for(var i=0,a=new Array(e);it.width?3===i?h=t.height*r:s=t.width/r:3===i?s=t.width/r:h=t.height*r;var c={aspectRatio:r,naturalWidth:n,naturalHeight:o,width:h,height:s};c.left=(t.width-h)/2,c.top=(t.height-s)/2,c.oldLeft=c.left,c.oldTop=c.top,this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),this.initialImageData=rt({},e),this.initialCanvasData=rt({},c)},limitCanvas:function(t,e){var i,a,n,o,r,h=this.options,s=this.containerData,c=this.canvasData,d=this.cropBoxData,l=h.viewMode,p=c.aspectRatio,m=this.cropped&&d;t&&(a=Number(h.minCanvasWidth)||0,n=Number(h.minCanvasHeight)||0,1=s.width&&(c.minLeft=Math.min(0,o),c.maxLeft=Math.max(0,o)),c.height>=s.height&&(c.minTop=Math.min(0,r),c.maxTop=Math.max(0,r))))):(c.minLeft=-c.width,c.minTop=-c.height,c.maxLeft=s.width,c.maxTop=s.height))},renderCanvas:function(t,e){var i,a,n,o,r,h=this.canvasData,s=this.imageData;e&&(a=(i=function(t){var e=t.width,i=t.height,a=t.degree;if(90===(a=Math.abs(a)%180))return{width:i,height:e};var n=a%90*Math.PI/180,o=Math.sin(n),r=Math.cos(n),h=e*r+i*o,s=e*o+i*r;return 90h.maxWidth||h.widthh.maxHeight||h.heighte.width?n.height=n.width/i:n.width=n.height*i),this.cropBoxData=n,this.limitCropBox(!0,!0),n.width=Math.min(Math.max(n.width,n.minWidth),n.maxWidth),n.height=Math.min(Math.max(n.height,n.minHeight),n.maxHeight),n.width=Math.max(n.minWidth,n.width*a),n.height=Math.max(n.minHeight,n.height*a),n.left=e.left+(e.width-n.width)/2,n.top=e.top+(e.height-n.height)/2,n.oldLeft=n.left,n.oldTop=n.top,this.initialCropBoxData=rt({},n)},limitCropBox:function(t,e){var i,a,n,o,r=this.options,h=this.containerData,s=this.canvasData,c=this.cropBoxData,d=this.limited,l=r.aspectRatio;t&&(n=Number(r.minCropBoxWidth)||0,o=Number(r.minCropBoxHeight)||0,i=d?Math.min(h.width,s.width,s.width+s.left,h.width-s.left):h.width,a=d?Math.min(h.height,s.height,s.height+s.top,h.height-s.top):h.height,n=Math.min(n,h.width),o=Math.min(o,h.height),l&&(n&&o?ni.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?E:O),ct(this.cropBox,rt({width:i.width,height:i.height},Lt({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ot(this.element,y,this.getData())}},jt={initPreview:function(){var t,e=this.element,i=this.crossOrigin,a=this.options.preview,n=i?this.crossOriginUrl:this.url,o=e.alt||"The image to preview",r=document.createElement("img");i&&(r.crossOrigin=i),r.src=n,r.alt=o,this.viewBox.appendChild(r),this.viewBoxImage=r,a&&("string"==typeof(t=a)?t=e.ownerDocument.querySelectorAll(a):a.querySelector&&(t=[a]),ot(this.previews=t,function(t){var e=document.createElement("img");ft(t,f,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),i&&(e.crossOrigin=i),e.src=n,e.alt=o,e.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(e)}))},resetPreview:function(){ot(this.previews,function(t){var e=gt(t,f);ct(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(e,i){if(_(e[i]))try{delete e[i]}catch(t){e[i]=void 0}else if(e.dataset)try{delete e.dataset[i]}catch(t){e.dataset[i]=void 0}else e.removeAttribute("data-".concat(ut(i)))}(t,f)})},preview:function(){var h=this.imageData,t=this.canvasData,e=this.cropBoxData,s=e.width,c=e.height,d=h.width,l=h.height,p=e.left-t.left-h.left,m=e.top-t.top-h.top;this.cropped&&!this.disabled&&(ct(this.viewBoxImage,rt({width:d,height:l},Lt(rt({translateX:-p,translateY:-m},h)))),ot(this.previews,function(t){var e=gt(t,f),i=e.width,a=e.height,n=i,o=a,r=1;s&&(o=c*(r=i/s)),c&&av&&(B.x=v-m);break;case H:c+B.xw&&(B.y=w-u)}}var x,M,C,D=r[Object.keys(r)[0]],B={x:D.endX-D.startX,y:D.endY-D.startY};switch(h){case O:c+=B.x,d+=B.y;break;case N:if(0<=B.x&&(v<=m||s&&(d<=f||w<=u))){b=!1;break}y(N),(l+=B.x)<0&&(h=H,c-=l=-l),s&&(p=l/s,d+=(o.height-p)/2);break;case z:if(B.y<=0&&(d<=f||s&&(c<=g||v<=m))){b=!1;break}y(z),p-=B.y,d+=B.y,p<0&&(h=L,d-=p=-p),s&&(l=p*s,c+=(o.width-l)/2);break;case H:if(B.x<=0&&(c<=g||s&&(d<=f||w<=u))){b=!1;break}y(H),l-=B.x,c+=B.x,l<0&&(h=N,c-=l=-l),s&&(p=l/s,d+=(o.height-p)/2);break;case L:if(0<=B.y&&(w<=u||s&&(c<=g||v<=m))){b=!1;break}y(L),(p+=B.y)<0&&(h=z,d-=p=-p),s&&(l=p*s,c+=(o.width-l)/2);break;case Y:if(s){if(B.y<=0&&(d<=f||v<=m)){b=!1;break}y(z),p-=B.y,d+=B.y,l=p*s}else y(z),y(N),!(0<=B.x)||m or element.");this.element=t,this.options=rt({},Z,et(e)&&e),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var t,e,a;return t=i,a=[{key:"noConflict",value:function(){return window.Cropper=$t,i}},{key:"setDefaults",value:function(t){rt(Z,et(t)&&t)}}],(e=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[d]){if(e[d]=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",!(this.originalUrl=t))return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e,i,a,n,o,r,h,s,c=this;t&&(this.url=t,this.imageData={},e=this.element,(i=this.options).rotatable||i.scalable||(i.checkOrientation=!1),i.checkOrientation&&window.ArrayBuffer?$.test(t)?Q.test(t)?this.read((a=t.replace(Rt,""),n=atob(a),o=new ArrayBuffer(n.length),ot(r=new Uint8Array(o),function(t,e){r[e]=n.charCodeAt(e)}),o)):this.clone():(h=new XMLHttpRequest,s=this.clone.bind(this),this.reloading=!0,(this.xhr=h).onabort=s,h.onerror=s,h.ontimeout=s,h.onprogress=function(){h.getResponseHeader("content-type")!==U&&h.abort()},h.onload=function(){c.read(h.response)},h.onloadend=function(){c.reloading=!1,c.xhr=null},i.checkCrossOrigin&&Nt(t)&&e.crossOrigin&&(t=Ht(t)),h.open("GET",t),h.responseType="arraybuffer",h.withCredentials="use-credentials"===e.crossOrigin,h.send()):this.clone())}},{key:"read",value:function(t){var e,i=this.options,a=this.imageData,n=St(t),o=0,r=1,h=1;1
',r=(o=n.querySelector(".".concat(d,"-container"))).querySelector(".".concat(d,"-canvas")),h=o.querySelector(".".concat(d,"-drag-box")),c=(s=o.querySelector(".".concat(d,"-crop-box"))).querySelector(".".concat(d,"-face")),this.container=a,this.cropper=o,this.canvas=r,this.dragBox=h,this.cropBox=s,this.viewBox=o.querySelector(".".concat(d,"-view-box")),this.face=c,r.appendChild(i),dt(t,A),a.insertBefore(o,t.nextSibling),this.isImg||lt(i,l),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,dt(s,A),e.guides||dt(s.getElementsByClassName("".concat(d,"-dashed")),A),e.center||dt(s.getElementsByClassName("".concat(d,"-center")),A),e.background&&dt(o,"".concat(d,"-bg")),e.highlight||dt(c,p),e.cropBoxMovable&&(dt(c,u),ft(c,g,O)),e.cropBoxResizable||(dt(s.getElementsByClassName("".concat(d,"-line")),A),dt(s.getElementsByClassName("".concat(d,"-point")),A)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),it(e.ready)&&kt(t,"ready",e.ready,{once:!0}),Ot(t,"ready"))}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),lt(this.element,A))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}])&&n(t.prototype,e),a&&n(t,a),i}();return rt(Qt.prototype,At,jt,It,Pt,Ut,qt),Qt}); \ No newline at end of file diff --git a/library/cropperjs/docs/css/cropper.css b/library/cropperjs/docs/css/cropper.css index d54319a64..d914b48fd 100644 --- a/library/cropperjs/docs/css/cropper.css +++ b/library/cropperjs/docs/css/cropper.css @@ -1,11 +1,11 @@ /*! - * Cropper.js v1.5.6 + * Cropper.js v1.5.7 * https://fengyuanchen.github.io/cropperjs * * Copyright 2015-present Chen Fengyuan * Released under the MIT license * - * Date: 2019-10-04T04:33:44.164Z + * Date: 2020-05-23T05:22:57.283Z */ .cropper-container { diff --git a/library/cropperjs/docs/examples/cropper-in-modal.html b/library/cropperjs/docs/examples/cropper-in-modal.html index f36ff4e4e..343924ef8 100644 --- a/library/cropperjs/docs/examples/cropper-in-modal.html +++ b/library/cropperjs/docs/examples/cropper-in-modal.html @@ -5,7 +5,7 @@ Cropper.js - +