cropper_rails 1.0.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +6 -6
- data/VERSIONS.md +1 -0
- data/cropper_rails.gemspec +1 -1
- data/lib/cropper_rails/version.rb +3 -3
- data/vendor/assets/javascripts/cropper.js +220 -125
- data/vendor/assets/javascripts/jquery-cropper.js +11 -13
- data/vendor/assets/stylesheets/cropper.css +14 -14
- metadata +5 -7
- data/.rubocop.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a48cf73eef4a56b9f3e4f8ac2194e85d67081e08c69ff1e3285117a903809847
|
4
|
+
data.tar.gz: cf99aed64a5e250797ee0d52c2ff0cb0085cd2f7fe2b724489170c6b6a3d5ea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f2bd0297ff274f2b478f23251734d2a66e64a07f4901ce8b9c6a5d528b864ca32e28af51e3b90f49b9e1e41a1f676c40402b3aba7840881e80b8a0aba164133
|
7
|
+
data.tar.gz: 14bcc7f5181847b6435eb24b73bf3c2d4699cb7da97376a116f3484a97e9040a7612572021167a7a3927a1eb5542f6be28cacb806b3561f7eac0ec5271d022a3
|
data/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
MIT License
|
1
|
+
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright
|
3
|
+
Copyright 2015-present Chen Fengyuan
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
10
10
|
furnished to do so, subject to the following conditions:
|
11
11
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
copies or substantial portions of the Software.
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
14
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
SOFTWARE.
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/VERSIONS.md
CHANGED
data/cropper_rails.gemspec
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
/*!
|
2
|
-
* Cropper.js v1.
|
2
|
+
* Cropper.js v1.5.6
|
3
3
|
* https://fengyuanchen.github.io/cropperjs
|
4
4
|
*
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
6
6
|
* Released under the MIT license
|
7
7
|
*
|
8
|
-
* Date:
|
8
|
+
* Date: 2019-10-04T04:33:48.372Z
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function (global, factory) {
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
13
13
|
typeof define === 'function' && define.amd ? define(factory) :
|
14
|
-
(global.Cropper = factory());
|
15
|
-
}(this,
|
14
|
+
(global = global || self, global.Cropper = factory());
|
15
|
+
}(this, function () { 'use strict';
|
16
16
|
|
17
17
|
function _typeof(obj) {
|
18
18
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
@@ -50,6 +50,55 @@
|
|
50
50
|
return Constructor;
|
51
51
|
}
|
52
52
|
|
53
|
+
function _defineProperty(obj, key, value) {
|
54
|
+
if (key in obj) {
|
55
|
+
Object.defineProperty(obj, key, {
|
56
|
+
value: value,
|
57
|
+
enumerable: true,
|
58
|
+
configurable: true,
|
59
|
+
writable: true
|
60
|
+
});
|
61
|
+
} else {
|
62
|
+
obj[key] = value;
|
63
|
+
}
|
64
|
+
|
65
|
+
return obj;
|
66
|
+
}
|
67
|
+
|
68
|
+
function ownKeys(object, enumerableOnly) {
|
69
|
+
var keys = Object.keys(object);
|
70
|
+
|
71
|
+
if (Object.getOwnPropertySymbols) {
|
72
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
73
|
+
if (enumerableOnly) symbols = symbols.filter(function (sym) {
|
74
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
75
|
+
});
|
76
|
+
keys.push.apply(keys, symbols);
|
77
|
+
}
|
78
|
+
|
79
|
+
return keys;
|
80
|
+
}
|
81
|
+
|
82
|
+
function _objectSpread2(target) {
|
83
|
+
for (var i = 1; i < arguments.length; i++) {
|
84
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
85
|
+
|
86
|
+
if (i % 2) {
|
87
|
+
ownKeys(source, true).forEach(function (key) {
|
88
|
+
_defineProperty(target, key, source[key]);
|
89
|
+
});
|
90
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
91
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
92
|
+
} else {
|
93
|
+
ownKeys(source).forEach(function (key) {
|
94
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
95
|
+
});
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
return target;
|
100
|
+
}
|
101
|
+
|
53
102
|
function _toConsumableArray(arr) {
|
54
103
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
55
104
|
}
|
@@ -70,8 +119,10 @@
|
|
70
119
|
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
71
120
|
}
|
72
121
|
|
73
|
-
var
|
74
|
-
var WINDOW =
|
122
|
+
var IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined';
|
123
|
+
var WINDOW = IS_BROWSER ? window : {};
|
124
|
+
var IS_TOUCH_DEVICE = IS_BROWSER ? 'ontouchstart' in WINDOW.document.documentElement : false;
|
125
|
+
var HAS_POINTER_EVENT = IS_BROWSER ? 'PointerEvent' in WINDOW : false;
|
75
126
|
var NAMESPACE = 'cropper'; // Actions
|
76
127
|
|
77
128
|
var ACTION_ALL = 'all';
|
@@ -107,20 +158,27 @@
|
|
107
158
|
var EVENT_CROP_MOVE = 'cropmove';
|
108
159
|
var EVENT_CROP_START = 'cropstart';
|
109
160
|
var EVENT_DBLCLICK = 'dblclick';
|
110
|
-
var
|
111
|
-
var
|
112
|
-
var
|
161
|
+
var EVENT_TOUCH_START = IS_TOUCH_DEVICE ? 'touchstart' : 'mousedown';
|
162
|
+
var EVENT_TOUCH_MOVE = IS_TOUCH_DEVICE ? 'touchmove' : 'mousemove';
|
163
|
+
var EVENT_TOUCH_END = IS_TOUCH_DEVICE ? 'touchend touchcancel' : 'mouseup';
|
164
|
+
var EVENT_POINTER_DOWN = HAS_POINTER_EVENT ? 'pointerdown' : EVENT_TOUCH_START;
|
165
|
+
var EVENT_POINTER_MOVE = HAS_POINTER_EVENT ? 'pointermove' : EVENT_TOUCH_MOVE;
|
166
|
+
var EVENT_POINTER_UP = HAS_POINTER_EVENT ? 'pointerup pointercancel' : EVENT_TOUCH_END;
|
113
167
|
var EVENT_READY = 'ready';
|
114
168
|
var EVENT_RESIZE = 'resize';
|
115
|
-
var EVENT_WHEEL = 'wheel
|
169
|
+
var EVENT_WHEEL = 'wheel';
|
116
170
|
var EVENT_ZOOM = 'zoom'; // Mime types
|
117
171
|
|
118
172
|
var MIME_TYPE_JPEG = 'image/jpeg'; // RegExps
|
119
173
|
|
120
|
-
var REGEXP_ACTIONS = /^
|
174
|
+
var REGEXP_ACTIONS = /^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/;
|
121
175
|
var REGEXP_DATA_URL = /^data:/;
|
122
176
|
var REGEXP_DATA_URL_JPEG = /^data:image\/jpeg;base64,/;
|
123
|
-
var REGEXP_TAG_NAME = /^
|
177
|
+
var REGEXP_TAG_NAME = /^img|canvas$/i; // Misc
|
178
|
+
// Inspired by the default width and height of a canvas element.
|
179
|
+
|
180
|
+
var MIN_CONTAINER_WIDTH = 200;
|
181
|
+
var MIN_CONTAINER_HEIGHT = 100;
|
124
182
|
|
125
183
|
var DEFAULTS = {
|
126
184
|
// Define the view mode of the cropper
|
@@ -211,6 +269,15 @@
|
|
211
269
|
function isNumber(value) {
|
212
270
|
return typeof value === 'number' && !isNaN(value);
|
213
271
|
}
|
272
|
+
/**
|
273
|
+
* Check if the given value is a positive number.
|
274
|
+
* @param {*} value - The value to check.
|
275
|
+
* @returns {boolean} Returns `true` if the given value is a positive number, else `false`.
|
276
|
+
*/
|
277
|
+
|
278
|
+
var isPositiveNumber = function isPositiveNumber(value) {
|
279
|
+
return value > 0 && value < Infinity;
|
280
|
+
};
|
214
281
|
/**
|
215
282
|
* Check if the given value is undefined.
|
216
283
|
* @param {*} value - The value to check.
|
@@ -245,7 +312,7 @@
|
|
245
312
|
var _constructor = value.constructor;
|
246
313
|
var prototype = _constructor.prototype;
|
247
314
|
return _constructor && prototype && hasOwnProperty.call(prototype, 'isPrototypeOf');
|
248
|
-
} catch (
|
315
|
+
} catch (error) {
|
249
316
|
return false;
|
250
317
|
}
|
251
318
|
}
|
@@ -258,6 +325,16 @@
|
|
258
325
|
function isFunction(value) {
|
259
326
|
return typeof value === 'function';
|
260
327
|
}
|
328
|
+
var slice = Array.prototype.slice;
|
329
|
+
/**
|
330
|
+
* Convert array-like or iterable object to an array.
|
331
|
+
* @param {*} value - The value to convert.
|
332
|
+
* @returns {Array} Returns a new array.
|
333
|
+
*/
|
334
|
+
|
335
|
+
function toArray(value) {
|
336
|
+
return Array.from ? Array.from(value) : slice.call(value);
|
337
|
+
}
|
261
338
|
/**
|
262
339
|
* Iterate the given data.
|
263
340
|
* @param {*} data - The data to iterate.
|
@@ -270,14 +347,9 @@
|
|
270
347
|
if (Array.isArray(data) || isNumber(data.length)
|
271
348
|
/* array-like */
|
272
349
|
) {
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
for (i = 0; i < length; i += 1) {
|
277
|
-
if (callback.call(data, data[i], i, data) === false) {
|
278
|
-
break;
|
279
|
-
}
|
280
|
-
}
|
350
|
+
toArray(data).forEach(function (value, key) {
|
351
|
+
callback.call(data, value, key, data);
|
352
|
+
});
|
281
353
|
} else if (isObject(data)) {
|
282
354
|
Object.keys(data).forEach(function (key) {
|
283
355
|
callback.call(data, data[key], key, data);
|
@@ -289,27 +361,27 @@
|
|
289
361
|
}
|
290
362
|
/**
|
291
363
|
* Extend the given object.
|
292
|
-
* @param {*}
|
293
|
-
* @param {*} args - The rest objects
|
364
|
+
* @param {*} target - The target object to extend.
|
365
|
+
* @param {*} args - The rest objects for merging to the target object.
|
294
366
|
* @returns {Object} The extended object.
|
295
367
|
*/
|
296
368
|
|
297
|
-
var assign = Object.assign || function assign(
|
369
|
+
var assign = Object.assign || function assign(target) {
|
298
370
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
299
371
|
args[_key - 1] = arguments[_key];
|
300
372
|
}
|
301
373
|
|
302
|
-
if (isObject(
|
374
|
+
if (isObject(target) && args.length > 0) {
|
303
375
|
args.forEach(function (arg) {
|
304
376
|
if (isObject(arg)) {
|
305
377
|
Object.keys(arg).forEach(function (key) {
|
306
|
-
|
378
|
+
target[key] = arg[key];
|
307
379
|
});
|
308
380
|
}
|
309
381
|
});
|
310
382
|
}
|
311
383
|
|
312
|
-
return
|
384
|
+
return target;
|
313
385
|
};
|
314
386
|
var REGEXP_DECIMALS = /\.\d*(?:0|9){12}\d*$/;
|
315
387
|
/**
|
@@ -324,7 +396,7 @@
|
|
324
396
|
var times = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100000000000;
|
325
397
|
return REGEXP_DECIMALS.test(value) ? Math.round(value * times) / times : value;
|
326
398
|
}
|
327
|
-
var REGEXP_SUFFIX = /^
|
399
|
+
var REGEXP_SUFFIX = /^width|height|left|top|marginLeft|marginTop$/;
|
328
400
|
/**
|
329
401
|
* Apply styles to the given element.
|
330
402
|
* @param {Element} element - The target element.
|
@@ -335,7 +407,7 @@
|
|
335
407
|
var style = element.style;
|
336
408
|
forEach(styles, function (value, property) {
|
337
409
|
if (REGEXP_SUFFIX.test(property) && isNumber(value)) {
|
338
|
-
value
|
410
|
+
value = "".concat(value, "px");
|
339
411
|
}
|
340
412
|
|
341
413
|
style[property] = value;
|
@@ -435,15 +507,15 @@
|
|
435
507
|
removeClass(element, value);
|
436
508
|
}
|
437
509
|
}
|
438
|
-
var
|
510
|
+
var REGEXP_CAMEL_CASE = /([a-z\d])([A-Z])/g;
|
439
511
|
/**
|
440
512
|
* Transform the given string from camelCase to kebab-case
|
441
513
|
* @param {string} value - The value to transform.
|
442
514
|
* @returns {string} The transformed value.
|
443
515
|
*/
|
444
516
|
|
445
|
-
function
|
446
|
-
return value.replace(
|
517
|
+
function toParamCase(value) {
|
518
|
+
return value.replace(REGEXP_CAMEL_CASE, '$1-$2').toLowerCase();
|
447
519
|
}
|
448
520
|
/**
|
449
521
|
* Get data from the given element.
|
@@ -461,7 +533,7 @@
|
|
461
533
|
return element.dataset[name];
|
462
534
|
}
|
463
535
|
|
464
|
-
return element.getAttribute("data-".concat(
|
536
|
+
return element.getAttribute("data-".concat(toParamCase(name)));
|
465
537
|
}
|
466
538
|
/**
|
467
539
|
* Set data to the given element.
|
@@ -476,7 +548,7 @@
|
|
476
548
|
} else if (element.dataset) {
|
477
549
|
element.dataset[name] = data;
|
478
550
|
} else {
|
479
|
-
element.setAttribute("data-".concat(
|
551
|
+
element.setAttribute("data-".concat(toParamCase(name)), data);
|
480
552
|
}
|
481
553
|
}
|
482
554
|
/**
|
@@ -489,18 +561,18 @@
|
|
489
561
|
if (isObject(element[name])) {
|
490
562
|
try {
|
491
563
|
delete element[name];
|
492
|
-
} catch (
|
564
|
+
} catch (error) {
|
493
565
|
element[name] = undefined;
|
494
566
|
}
|
495
567
|
} else if (element.dataset) {
|
496
568
|
// #128 Safari not allows to delete dataset property
|
497
569
|
try {
|
498
570
|
delete element.dataset[name];
|
499
|
-
} catch (
|
571
|
+
} catch (error) {
|
500
572
|
element.dataset[name] = undefined;
|
501
573
|
}
|
502
574
|
} else {
|
503
|
-
element.removeAttribute("data-".concat(
|
575
|
+
element.removeAttribute("data-".concat(toParamCase(name)));
|
504
576
|
}
|
505
577
|
}
|
506
578
|
var REGEXP_SPACES = /\s\s*/;
|
@@ -508,7 +580,7 @@
|
|
508
580
|
var onceSupported = function () {
|
509
581
|
var supported = false;
|
510
582
|
|
511
|
-
if (
|
583
|
+
if (IS_BROWSER) {
|
512
584
|
var once = false;
|
513
585
|
|
514
586
|
var listener = function listener() {};
|
@@ -647,7 +719,7 @@
|
|
647
719
|
};
|
648
720
|
}
|
649
721
|
var location = WINDOW.location;
|
650
|
-
var REGEXP_ORIGINS = /^(
|
722
|
+
var REGEXP_ORIGINS = /^(\w+:)\/\/([^:/?#]*):?(\d*)/i;
|
651
723
|
/**
|
652
724
|
* Check if the given URL is a cross origin URL.
|
653
725
|
* @param {string} url - The target URL.
|
@@ -656,7 +728,7 @@
|
|
656
728
|
|
657
729
|
function isCrossOriginURL(url) {
|
658
730
|
var parts = url.match(REGEXP_ORIGINS);
|
659
|
-
return parts && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
|
731
|
+
return parts !== null && (parts[1] !== location.protocol || parts[2] !== location.hostname || parts[3] !== location.port);
|
660
732
|
}
|
661
733
|
/**
|
662
734
|
* Add timestamp to the given URL.
|
@@ -717,7 +789,8 @@
|
|
717
789
|
*/
|
718
790
|
|
719
791
|
function getMaxZoomRatio(pointers) {
|
720
|
-
var pointers2 =
|
792
|
+
var pointers2 = _objectSpread2({}, pointers);
|
793
|
+
|
721
794
|
var ratios = [];
|
722
795
|
forEach(pointers, function (pointer, pointerId) {
|
723
796
|
delete pointers2[pointerId];
|
@@ -751,7 +824,7 @@
|
|
751
824
|
endX: pageX,
|
752
825
|
endY: pageY
|
753
826
|
};
|
754
|
-
return endOnly ? end :
|
827
|
+
return endOnly ? end : _objectSpread2({
|
755
828
|
startX: pageX,
|
756
829
|
startY: pageY
|
757
830
|
}, end);
|
@@ -780,11 +853,6 @@
|
|
780
853
|
pageY: pageY
|
781
854
|
};
|
782
855
|
}
|
783
|
-
/**
|
784
|
-
* Check if the given value is a finite number.
|
785
|
-
*/
|
786
|
-
|
787
|
-
var isFinite = Number.isFinite || WINDOW.isFinite;
|
788
856
|
/**
|
789
857
|
* Get the max sizes in a rectangle under the given aspect ratio.
|
790
858
|
* @param {Object} data - The original sizes.
|
@@ -798,12 +866,10 @@
|
|
798
866
|
height = _ref4.height,
|
799
867
|
width = _ref4.width;
|
800
868
|
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'contain';
|
869
|
+
var isValidWidth = isPositiveNumber(width);
|
870
|
+
var isValidHeight = isPositiveNumber(height);
|
801
871
|
|
802
|
-
|
803
|
-
return isFinite(value) && value > 0;
|
804
|
-
};
|
805
|
-
|
806
|
-
if (isValidNumber(width) && isValidNumber(height)) {
|
872
|
+
if (isValidWidth && isValidHeight) {
|
807
873
|
var adjustedWidth = height * aspectRatio;
|
808
874
|
|
809
875
|
if (type === 'contain' && adjustedWidth > width || type === 'cover' && adjustedWidth < width) {
|
@@ -811,9 +877,9 @@
|
|
811
877
|
} else {
|
812
878
|
width = height * aspectRatio;
|
813
879
|
}
|
814
|
-
} else if (
|
880
|
+
} else if (isValidWidth) {
|
815
881
|
height = width / aspectRatio;
|
816
|
-
} else if (
|
882
|
+
} else if (isValidHeight) {
|
817
883
|
width = height * aspectRatio;
|
818
884
|
}
|
819
885
|
|
@@ -946,10 +1012,9 @@
|
|
946
1012
|
|
947
1013
|
function getStringFromCharCode(dataView, start, length) {
|
948
1014
|
var str = '';
|
949
|
-
var i;
|
950
1015
|
length += start;
|
951
1016
|
|
952
|
-
for (i = start; i < length; i += 1) {
|
1017
|
+
for (var i = start; i < length; i += 1) {
|
953
1018
|
str += fromCharCode(dataView.getUint8(i));
|
954
1019
|
}
|
955
1020
|
|
@@ -980,12 +1045,15 @@
|
|
980
1045
|
*/
|
981
1046
|
|
982
1047
|
function arrayBufferToDataURL(arrayBuffer, mimeType) {
|
983
|
-
var chunks = [];
|
1048
|
+
var chunks = []; // Chunk Typed Array for better performance (#435)
|
1049
|
+
|
984
1050
|
var chunkSize = 8192;
|
985
1051
|
var uint8 = new Uint8Array(arrayBuffer);
|
986
1052
|
|
987
1053
|
while (uint8.length > 0) {
|
988
|
-
|
1054
|
+
// XXX: Babel's `toConsumableArray` helper will throw error in IE or Safari 9
|
1055
|
+
// eslint-disable-next-line prefer-spread
|
1056
|
+
chunks.push(fromCharCode.apply(null, toArray(uint8.subarray(0, chunkSize))));
|
989
1057
|
uint8 = uint8.subarray(chunkSize);
|
990
1058
|
}
|
991
1059
|
|
@@ -1065,7 +1133,7 @@
|
|
1065
1133
|
}
|
1066
1134
|
}
|
1067
1135
|
}
|
1068
|
-
} catch (
|
1136
|
+
} catch (error) {
|
1069
1137
|
orientation = 1;
|
1070
1138
|
}
|
1071
1139
|
|
@@ -1507,9 +1575,11 @@
|
|
1507
1575
|
|
1508
1576
|
var preview = {
|
1509
1577
|
initPreview: function initPreview() {
|
1510
|
-
var
|
1578
|
+
var element = this.element,
|
1579
|
+
crossOrigin = this.crossOrigin;
|
1511
1580
|
var preview = this.options.preview;
|
1512
1581
|
var url = crossOrigin ? this.crossOriginUrl : this.url;
|
1582
|
+
var alt = element.alt || 'The image to preview';
|
1513
1583
|
var image = document.createElement('img');
|
1514
1584
|
|
1515
1585
|
if (crossOrigin) {
|
@@ -1517,6 +1587,7 @@
|
|
1517
1587
|
}
|
1518
1588
|
|
1519
1589
|
image.src = url;
|
1590
|
+
image.alt = alt;
|
1520
1591
|
this.viewBox.appendChild(image);
|
1521
1592
|
this.viewBoxImage = image;
|
1522
1593
|
|
@@ -1527,7 +1598,7 @@
|
|
1527
1598
|
var previews = preview;
|
1528
1599
|
|
1529
1600
|
if (typeof preview === 'string') {
|
1530
|
-
previews =
|
1601
|
+
previews = element.ownerDocument.querySelectorAll(preview);
|
1531
1602
|
} else if (preview.querySelector) {
|
1532
1603
|
previews = [preview];
|
1533
1604
|
}
|
@@ -1547,6 +1618,7 @@
|
|
1547
1618
|
}
|
1548
1619
|
|
1549
1620
|
img.src = url;
|
1621
|
+
img.alt = alt;
|
1550
1622
|
/**
|
1551
1623
|
* Override img element styles
|
1552
1624
|
* Add `display:block` to avoid margin top issue
|
@@ -1655,7 +1727,10 @@
|
|
1655
1727
|
addListener(cropper, EVENT_POINTER_DOWN, this.onCropStart = this.cropStart.bind(this));
|
1656
1728
|
|
1657
1729
|
if (options.zoomable && options.zoomOnWheel) {
|
1658
|
-
addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this)
|
1730
|
+
addListener(cropper, EVENT_WHEEL, this.onWheel = this.wheel.bind(this), {
|
1731
|
+
passive: false,
|
1732
|
+
capture: true
|
1733
|
+
});
|
1659
1734
|
}
|
1660
1735
|
|
1661
1736
|
if (options.toggleDragModeOnDblclick) {
|
@@ -1697,7 +1772,10 @@
|
|
1697
1772
|
removeListener(cropper, EVENT_POINTER_DOWN, this.onCropStart);
|
1698
1773
|
|
1699
1774
|
if (options.zoomable && options.zoomOnWheel) {
|
1700
|
-
removeListener(cropper, EVENT_WHEEL, this.onWheel
|
1775
|
+
removeListener(cropper, EVENT_WHEEL, this.onWheel, {
|
1776
|
+
passive: false,
|
1777
|
+
capture: true
|
1778
|
+
});
|
1701
1779
|
}
|
1702
1780
|
|
1703
1781
|
if (options.toggleDragModeOnDblclick) {
|
@@ -1718,8 +1796,8 @@
|
|
1718
1796
|
var options = this.options,
|
1719
1797
|
container = this.container,
|
1720
1798
|
containerData = this.containerData;
|
1721
|
-
var minContainerWidth = Number(options.minContainerWidth) ||
|
1722
|
-
var minContainerHeight = Number(options.minContainerHeight) ||
|
1799
|
+
var minContainerWidth = Number(options.minContainerWidth) || MIN_CONTAINER_WIDTH;
|
1800
|
+
var minContainerHeight = Number(options.minContainerHeight) || MIN_CONTAINER_HEIGHT;
|
1723
1801
|
|
1724
1802
|
if (this.disabled || containerData.width <= minContainerWidth || containerData.height <= minContainerHeight) {
|
1725
1803
|
return;
|
@@ -1755,7 +1833,7 @@
|
|
1755
1833
|
|
1756
1834
|
this.setDragMode(hasClass(this.dragBox, CLASS_CROP) ? DRAG_MODE_MOVE : DRAG_MODE_CROP);
|
1757
1835
|
},
|
1758
|
-
wheel: function wheel(
|
1836
|
+
wheel: function wheel(event) {
|
1759
1837
|
var _this = this;
|
1760
1838
|
|
1761
1839
|
var ratio = Number(this.options.wheelZoomRatio) || 0.1;
|
@@ -1765,7 +1843,7 @@
|
|
1765
1843
|
return;
|
1766
1844
|
}
|
1767
1845
|
|
1768
|
-
|
1846
|
+
event.preventDefault(); // Limit wheel speed to prevent zoom too fast (#21)
|
1769
1847
|
|
1770
1848
|
if (this.wheeling) {
|
1771
1849
|
return;
|
@@ -1776,18 +1854,24 @@
|
|
1776
1854
|
_this.wheeling = false;
|
1777
1855
|
}, 50);
|
1778
1856
|
|
1779
|
-
if (
|
1780
|
-
delta =
|
1781
|
-
} else if (
|
1782
|
-
delta = -
|
1783
|
-
} else if (
|
1784
|
-
delta =
|
1857
|
+
if (event.deltaY) {
|
1858
|
+
delta = event.deltaY > 0 ? 1 : -1;
|
1859
|
+
} else if (event.wheelDelta) {
|
1860
|
+
delta = -event.wheelDelta / 120;
|
1861
|
+
} else if (event.detail) {
|
1862
|
+
delta = event.detail > 0 ? 1 : -1;
|
1785
1863
|
}
|
1786
1864
|
|
1787
|
-
this.zoom(-delta * ratio,
|
1865
|
+
this.zoom(-delta * ratio, event);
|
1788
1866
|
},
|
1789
|
-
cropStart: function cropStart(
|
1790
|
-
|
1867
|
+
cropStart: function cropStart(event) {
|
1868
|
+
var buttons = event.buttons,
|
1869
|
+
button = event.button;
|
1870
|
+
|
1871
|
+
if (this.disabled // Handle mouse event and pointer event and ignore touch event
|
1872
|
+
|| (event.type === 'mousedown' || event.type === 'pointerdown' && event.pointerType === 'mouse') && ( // No primary button (Usually the left button)
|
1873
|
+
isNumber(buttons) && buttons !== 1 || isNumber(button) && button !== 0 // Open context menu
|
1874
|
+
|| event.ctrlKey)) {
|
1791
1875
|
return;
|
1792
1876
|
}
|
1793
1877
|
|
@@ -1795,20 +1879,20 @@
|
|
1795
1879
|
pointers = this.pointers;
|
1796
1880
|
var action;
|
1797
1881
|
|
1798
|
-
if (
|
1882
|
+
if (event.changedTouches) {
|
1799
1883
|
// Handle touch event
|
1800
|
-
forEach(
|
1884
|
+
forEach(event.changedTouches, function (touch) {
|
1801
1885
|
pointers[touch.identifier] = getPointer(touch);
|
1802
1886
|
});
|
1803
1887
|
} else {
|
1804
1888
|
// Handle mouse event and pointer event
|
1805
|
-
pointers[
|
1889
|
+
pointers[event.pointerId || 0] = getPointer(event);
|
1806
1890
|
}
|
1807
1891
|
|
1808
1892
|
if (Object.keys(pointers).length > 1 && options.zoomable && options.zoomOnTouch) {
|
1809
1893
|
action = ACTION_ZOOM;
|
1810
1894
|
} else {
|
1811
|
-
action = getData(
|
1895
|
+
action = getData(event.target, DATA_ACTION);
|
1812
1896
|
}
|
1813
1897
|
|
1814
1898
|
if (!REGEXP_ACTIONS.test(action)) {
|
@@ -1816,14 +1900,14 @@
|
|
1816
1900
|
}
|
1817
1901
|
|
1818
1902
|
if (dispatchEvent(this.element, EVENT_CROP_START, {
|
1819
|
-
originalEvent:
|
1903
|
+
originalEvent: event,
|
1820
1904
|
action: action
|
1821
1905
|
}) === false) {
|
1822
1906
|
return;
|
1823
1907
|
} // This line is required for preventing page zooming in iOS browsers
|
1824
1908
|
|
1825
1909
|
|
1826
|
-
|
1910
|
+
event.preventDefault();
|
1827
1911
|
this.action = action;
|
1828
1912
|
this.cropping = false;
|
1829
1913
|
|
@@ -1832,7 +1916,7 @@
|
|
1832
1916
|
addClass(this.dragBox, CLASS_MODAL);
|
1833
1917
|
}
|
1834
1918
|
},
|
1835
|
-
cropMove: function cropMove(
|
1919
|
+
cropMove: function cropMove(event) {
|
1836
1920
|
var action = this.action;
|
1837
1921
|
|
1838
1922
|
if (this.disabled || !action) {
|
@@ -1840,27 +1924,27 @@
|
|
1840
1924
|
}
|
1841
1925
|
|
1842
1926
|
var pointers = this.pointers;
|
1843
|
-
|
1927
|
+
event.preventDefault();
|
1844
1928
|
|
1845
1929
|
if (dispatchEvent(this.element, EVENT_CROP_MOVE, {
|
1846
|
-
originalEvent:
|
1930
|
+
originalEvent: event,
|
1847
1931
|
action: action
|
1848
1932
|
}) === false) {
|
1849
1933
|
return;
|
1850
1934
|
}
|
1851
1935
|
|
1852
|
-
if (
|
1853
|
-
forEach(
|
1936
|
+
if (event.changedTouches) {
|
1937
|
+
forEach(event.changedTouches, function (touch) {
|
1854
1938
|
// The first parameter should not be undefined (#432)
|
1855
1939
|
assign(pointers[touch.identifier] || {}, getPointer(touch, true));
|
1856
1940
|
});
|
1857
1941
|
} else {
|
1858
|
-
assign(pointers[
|
1942
|
+
assign(pointers[event.pointerId || 0] || {}, getPointer(event, true));
|
1859
1943
|
}
|
1860
1944
|
|
1861
|
-
this.change(
|
1945
|
+
this.change(event);
|
1862
1946
|
},
|
1863
|
-
cropEnd: function cropEnd(
|
1947
|
+
cropEnd: function cropEnd(event) {
|
1864
1948
|
if (this.disabled) {
|
1865
1949
|
return;
|
1866
1950
|
}
|
@@ -1868,19 +1952,19 @@
|
|
1868
1952
|
var action = this.action,
|
1869
1953
|
pointers = this.pointers;
|
1870
1954
|
|
1871
|
-
if (
|
1872
|
-
forEach(
|
1955
|
+
if (event.changedTouches) {
|
1956
|
+
forEach(event.changedTouches, function (touch) {
|
1873
1957
|
delete pointers[touch.identifier];
|
1874
1958
|
});
|
1875
1959
|
} else {
|
1876
|
-
delete pointers[
|
1960
|
+
delete pointers[event.pointerId || 0];
|
1877
1961
|
}
|
1878
1962
|
|
1879
1963
|
if (!action) {
|
1880
1964
|
return;
|
1881
1965
|
}
|
1882
1966
|
|
1883
|
-
|
1967
|
+
event.preventDefault();
|
1884
1968
|
|
1885
1969
|
if (!Object.keys(pointers).length) {
|
1886
1970
|
this.action = '';
|
@@ -1892,14 +1976,14 @@
|
|
1892
1976
|
}
|
1893
1977
|
|
1894
1978
|
dispatchEvent(this.element, EVENT_CROP_END, {
|
1895
|
-
originalEvent:
|
1979
|
+
originalEvent: event,
|
1896
1980
|
action: action
|
1897
1981
|
});
|
1898
1982
|
}
|
1899
1983
|
};
|
1900
1984
|
|
1901
1985
|
var change = {
|
1902
|
-
change: function change(
|
1986
|
+
change: function change(event) {
|
1903
1987
|
var options = this.options,
|
1904
1988
|
canvasData = this.canvasData,
|
1905
1989
|
containerData = this.containerData,
|
@@ -1920,7 +2004,7 @@
|
|
1920
2004
|
var renderable = true;
|
1921
2005
|
var offset; // Locking aspect ratio in "free mode" by holding shift key
|
1922
2006
|
|
1923
|
-
if (!aspectRatio &&
|
2007
|
+
if (!aspectRatio && event.shiftKey) {
|
1924
2008
|
aspectRatio = width && height ? width / height : 1;
|
1925
2009
|
}
|
1926
2010
|
|
@@ -2293,7 +2377,7 @@
|
|
2293
2377
|
// Zoom canvas
|
2294
2378
|
|
2295
2379
|
case ACTION_ZOOM:
|
2296
|
-
this.zoom(getMaxZoomRatio(pointers),
|
2380
|
+
this.zoom(getMaxZoomRatio(pointers), event);
|
2297
2381
|
renderable = false;
|
2298
2382
|
break;
|
2299
2383
|
// Create crop box
|
@@ -2685,7 +2769,7 @@
|
|
2685
2769
|
* @param {boolean} [rounded=false] - Indicate if round the data values or not.
|
2686
2770
|
* @returns {Object} The result cropped data.
|
2687
2771
|
*/
|
2688
|
-
getData: function getData
|
2772
|
+
getData: function getData() {
|
2689
2773
|
var rounded = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
2690
2774
|
var options = this.options,
|
2691
2775
|
imageData = this.imageData,
|
@@ -2741,7 +2825,7 @@
|
|
2741
2825
|
* @param {Object} data - The new data.
|
2742
2826
|
* @returns {Cropper} this
|
2743
2827
|
*/
|
2744
|
-
setData: function setData
|
2828
|
+
setData: function setData(data) {
|
2745
2829
|
var options = this.options,
|
2746
2830
|
imageData = this.imageData,
|
2747
2831
|
canvasData = this.canvasData;
|
@@ -3198,28 +3282,38 @@
|
|
3198
3282
|
if (!options.checkOrientation || !window.ArrayBuffer) {
|
3199
3283
|
this.clone();
|
3200
3284
|
return;
|
3201
|
-
} //
|
3285
|
+
} // Detect the mime type of the image directly if it is a Data URL
|
3202
3286
|
|
3203
3287
|
|
3204
3288
|
if (REGEXP_DATA_URL.test(url)) {
|
3289
|
+
// Read ArrayBuffer from Data URL of JPEG images directly for better performance
|
3205
3290
|
if (REGEXP_DATA_URL_JPEG.test(url)) {
|
3206
3291
|
this.read(dataURLToArrayBuffer(url));
|
3207
3292
|
} else {
|
3293
|
+
// Only a JPEG image may contains Exif Orientation information,
|
3294
|
+
// the rest types of Data URLs are not necessary to check orientation at all.
|
3208
3295
|
this.clone();
|
3209
3296
|
}
|
3210
3297
|
|
3211
3298
|
return;
|
3212
|
-
}
|
3299
|
+
} // 1. Detect the mime type of the image by a XMLHttpRequest.
|
3300
|
+
// 2. Load the image as ArrayBuffer for reading orientation if its a JPEG image.
|
3301
|
+
|
3213
3302
|
|
3214
3303
|
var xhr = new XMLHttpRequest();
|
3215
3304
|
var clone = this.clone.bind(this);
|
3216
3305
|
this.reloading = true;
|
3217
|
-
this.xhr = xhr;
|
3218
|
-
|
3306
|
+
this.xhr = xhr; // 1. Cross origin requests are only supported for protocol schemes:
|
3307
|
+
// http, https, data, chrome, chrome-extension.
|
3308
|
+
// 2. Access to XMLHttpRequest from a Data URL will be blocked by CORS policy
|
3309
|
+
// in some browsers as IE11 and Safari.
|
3310
|
+
|
3219
3311
|
xhr.onabort = clone;
|
3220
3312
|
xhr.onerror = clone;
|
3313
|
+
xhr.ontimeout = clone;
|
3221
3314
|
|
3222
3315
|
xhr.onprogress = function () {
|
3316
|
+
// Abort the request directly if it not a JPEG image for better performance
|
3223
3317
|
if (xhr.getResponseHeader('content-type') !== MIME_TYPE_JPEG) {
|
3224
3318
|
xhr.abort();
|
3225
3319
|
}
|
@@ -3248,15 +3342,16 @@
|
|
3248
3342
|
key: "read",
|
3249
3343
|
value: function read(arrayBuffer) {
|
3250
3344
|
var options = this.options,
|
3251
|
-
imageData = this.imageData;
|
3345
|
+
imageData = this.imageData; // Reset the orientation value to its default value 1
|
3346
|
+
// as some iOS browsers will render image with its orientation
|
3347
|
+
|
3252
3348
|
var orientation = resetAndGetOrientation(arrayBuffer);
|
3253
3349
|
var rotate = 0;
|
3254
3350
|
var scaleX = 1;
|
3255
3351
|
var scaleY = 1;
|
3256
3352
|
|
3257
3353
|
if (orientation > 1) {
|
3258
|
-
// Generate a new
|
3259
|
-
// as some iOS browsers will render image with its orientation
|
3354
|
+
// Generate a new URL which has the default orientation value
|
3260
3355
|
this.url = arrayBufferToDataURL(arrayBuffer, MIME_TYPE_JPEG);
|
3261
3356
|
|
3262
3357
|
var _parseOrientation = parseOrientation(orientation);
|
@@ -3282,19 +3377,16 @@
|
|
3282
3377
|
value: function clone() {
|
3283
3378
|
var element = this.element,
|
3284
3379
|
url = this.url;
|
3285
|
-
var crossOrigin;
|
3286
|
-
var crossOriginUrl;
|
3380
|
+
var crossOrigin = element.crossOrigin;
|
3381
|
+
var crossOriginUrl = url;
|
3287
3382
|
|
3288
3383
|
if (this.options.checkCrossOrigin && isCrossOriginURL(url)) {
|
3289
|
-
crossOrigin
|
3384
|
+
if (!crossOrigin) {
|
3385
|
+
crossOrigin = 'anonymous';
|
3386
|
+
} // Bust cache when there is not a "crossOrigin" property (#519)
|
3290
3387
|
|
3291
|
-
if (crossOrigin) {
|
3292
|
-
crossOriginUrl = url;
|
3293
|
-
} else {
|
3294
|
-
crossOrigin = 'anonymous'; // Bust cache when there is not a "crossOrigin" property
|
3295
3388
|
|
3296
|
-
|
3297
|
-
}
|
3389
|
+
crossOriginUrl = addTimestamp(url);
|
3298
3390
|
}
|
3299
3391
|
|
3300
3392
|
this.crossOrigin = crossOrigin;
|
@@ -3306,6 +3398,7 @@
|
|
3306
3398
|
}
|
3307
3399
|
|
3308
3400
|
image.src = crossOriginUrl || url;
|
3401
|
+
image.alt = element.alt || 'The image to crop';
|
3309
3402
|
this.image = image;
|
3310
3403
|
image.onload = this.start.bind(this);
|
3311
3404
|
image.onerror = this.stop.bind(this);
|
@@ -3317,11 +3410,13 @@
|
|
3317
3410
|
value: function start() {
|
3318
3411
|
var _this2 = this;
|
3319
3412
|
|
3320
|
-
var image = this.
|
3413
|
+
var image = this.image;
|
3321
3414
|
image.onload = null;
|
3322
3415
|
image.onerror = null;
|
3323
|
-
this.sizing = true;
|
3324
|
-
|
3416
|
+
this.sizing = true; // Match all browsers that use WebKit as the layout engine in iOS devices,
|
3417
|
+
// such as Safari for iOS, Chrome for iOS, and in-app browsers.
|
3418
|
+
|
3419
|
+
var isIOSWebKit = WINDOW.navigator && /(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(WINDOW.navigator.userAgent);
|
3325
3420
|
|
3326
3421
|
var done = function done(naturalWidth, naturalHeight) {
|
3327
3422
|
assign(_this2.imageData, {
|
@@ -3333,10 +3428,10 @@
|
|
3333
3428
|
_this2.sized = true;
|
3334
3429
|
|
3335
3430
|
_this2.build();
|
3336
|
-
}; //
|
3431
|
+
}; // Most modern browsers (excepts iOS WebKit)
|
3337
3432
|
|
3338
3433
|
|
3339
|
-
if (image.naturalWidth && !
|
3434
|
+
if (image.naturalWidth && !isIOSWebKit) {
|
3340
3435
|
done(image.naturalWidth, image.naturalHeight);
|
3341
3436
|
return;
|
3342
3437
|
}
|
@@ -3348,15 +3443,15 @@
|
|
3348
3443
|
sizingImage.onload = function () {
|
3349
3444
|
done(sizingImage.width, sizingImage.height);
|
3350
3445
|
|
3351
|
-
if (!
|
3446
|
+
if (!isIOSWebKit) {
|
3352
3447
|
body.removeChild(sizingImage);
|
3353
3448
|
}
|
3354
3449
|
};
|
3355
3450
|
|
3356
|
-
sizingImage.src = image.src; // iOS
|
3451
|
+
sizingImage.src = image.src; // iOS WebKit will convert the image automatically
|
3357
3452
|
// with its orientation once append it into DOM (#279)
|
3358
3453
|
|
3359
|
-
if (!
|
3454
|
+
if (!isIOSWebKit) {
|
3360
3455
|
sizingImage.style.cssText = 'left:0;' + 'max-height:none!important;' + 'max-width:none!important;' + 'min-height:0!important;' + 'min-width:0!important;' + 'opacity:0;' + 'position:absolute;' + 'top:0;' + 'z-index:-1;';
|
3361
3456
|
body.appendChild(sizingImage);
|
3362
3457
|
}
|
@@ -3518,4 +3613,4 @@
|
|
3518
3613
|
|
3519
3614
|
return Cropper;
|
3520
3615
|
|
3521
|
-
}))
|
3616
|
+
}));
|
@@ -1,33 +1,32 @@
|
|
1
1
|
/*!
|
2
|
-
* jQuery Cropper v1.0.
|
3
|
-
* https://github.
|
2
|
+
* jQuery Cropper v1.0.1
|
3
|
+
* https://fengyuanchen.github.io/jquery-cropper
|
4
4
|
*
|
5
|
-
* Copyright
|
5
|
+
* Copyright 2018-present Chen Fengyuan
|
6
6
|
* Released under the MIT license
|
7
7
|
*
|
8
|
-
* Date:
|
8
|
+
* Date: 2019-10-19T08:48:33.062Z
|
9
9
|
*/
|
10
10
|
|
11
11
|
(function (global, factory) {
|
12
12
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('jquery'), require('cropperjs')) :
|
13
13
|
typeof define === 'function' && define.amd ? define(['jquery', 'cropperjs'], factory) :
|
14
|
-
(factory(global.jQuery,global.Cropper));
|
15
|
-
}(this,
|
14
|
+
(global = global || self, factory(global.jQuery, global.Cropper));
|
15
|
+
}(this, function ($, Cropper) { 'use strict';
|
16
16
|
|
17
17
|
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
18
18
|
Cropper = Cropper && Cropper.hasOwnProperty('default') ? Cropper['default'] : Cropper;
|
19
19
|
|
20
|
-
if ($.fn) {
|
20
|
+
if ($ && $.fn && Cropper) {
|
21
21
|
var AnotherCropper = $.fn.cropper;
|
22
22
|
var NAMESPACE = 'cropper';
|
23
23
|
|
24
24
|
$.fn.cropper = function jQueryCropper(option) {
|
25
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
25
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
26
26
|
args[_key - 1] = arguments[_key];
|
27
27
|
}
|
28
28
|
|
29
|
-
var result
|
30
|
-
|
29
|
+
var result;
|
31
30
|
this.each(function (i, element) {
|
32
31
|
var $element = $(element);
|
33
32
|
var isDestroy = option === 'destroy';
|
@@ -39,7 +38,6 @@
|
|
39
38
|
}
|
40
39
|
|
41
40
|
var options = $.extend({}, $element.data(), $.isPlainObject(option) && option);
|
42
|
-
|
43
41
|
cropper = new Cropper(element, options);
|
44
42
|
$element.data(NAMESPACE, cropper);
|
45
43
|
}
|
@@ -60,16 +58,16 @@
|
|
60
58
|
}
|
61
59
|
}
|
62
60
|
});
|
63
|
-
|
64
61
|
return result !== undefined ? result : this;
|
65
62
|
};
|
66
63
|
|
67
64
|
$.fn.cropper.Constructor = Cropper;
|
68
65
|
$.fn.cropper.setDefaults = Cropper.setDefaults;
|
66
|
+
|
69
67
|
$.fn.cropper.noConflict = function noConflict() {
|
70
68
|
$.fn.cropper = AnotherCropper;
|
71
69
|
return this;
|
72
70
|
};
|
73
71
|
}
|
74
72
|
|
75
|
-
}))
|
73
|
+
}));
|
@@ -1,11 +1,11 @@
|
|
1
1
|
/*!
|
2
|
-
* Cropper.js v1.
|
2
|
+
* Cropper.js v1.5.6
|
3
3
|
* https://fengyuanchen.github.io/cropperjs
|
4
4
|
*
|
5
5
|
* Copyright 2015-present Chen Fengyuan
|
6
6
|
* Released under the MIT license
|
7
7
|
*
|
8
|
-
* Date:
|
8
|
+
* Date: 2019-10-04T04:33:44.164Z
|
9
9
|
*/
|
10
10
|
|
11
11
|
.cropper-container {
|
@@ -56,14 +56,14 @@
|
|
56
56
|
|
57
57
|
.cropper-modal {
|
58
58
|
background-color: #000;
|
59
|
-
opacity: .5;
|
59
|
+
opacity: 0.5;
|
60
60
|
}
|
61
61
|
|
62
62
|
.cropper-view-box {
|
63
63
|
display: block;
|
64
64
|
height: 100%;
|
65
|
-
outline-color: rgba(51, 153, 255, 0.75);
|
66
65
|
outline: 1px solid #39f;
|
66
|
+
outline-color: rgba(51, 153, 255, 0.75);
|
67
67
|
overflow: hidden;
|
68
68
|
width: 100%;
|
69
69
|
}
|
@@ -71,7 +71,7 @@
|
|
71
71
|
.cropper-dashed {
|
72
72
|
border: 0 dashed #eee;
|
73
73
|
display: block;
|
74
|
-
opacity: .5;
|
74
|
+
opacity: 0.5;
|
75
75
|
position: absolute;
|
76
76
|
}
|
77
77
|
|
@@ -97,28 +97,28 @@
|
|
97
97
|
display: block;
|
98
98
|
height: 0;
|
99
99
|
left: 50%;
|
100
|
-
opacity: .75;
|
100
|
+
opacity: 0.75;
|
101
101
|
position: absolute;
|
102
102
|
top: 50%;
|
103
103
|
width: 0;
|
104
104
|
}
|
105
105
|
|
106
|
-
.cropper-center
|
107
|
-
.cropper-center
|
106
|
+
.cropper-center::before,
|
107
|
+
.cropper-center::after {
|
108
108
|
background-color: #eee;
|
109
109
|
content: ' ';
|
110
110
|
display: block;
|
111
111
|
position: absolute;
|
112
112
|
}
|
113
113
|
|
114
|
-
.cropper-center
|
114
|
+
.cropper-center::before {
|
115
115
|
height: 1px;
|
116
116
|
left: -3px;
|
117
117
|
top: 0;
|
118
118
|
width: 7px;
|
119
119
|
}
|
120
120
|
|
121
|
-
.cropper-center
|
121
|
+
.cropper-center::after {
|
122
122
|
height: 7px;
|
123
123
|
left: 0;
|
124
124
|
top: -3px;
|
@@ -130,7 +130,7 @@
|
|
130
130
|
.cropper-point {
|
131
131
|
display: block;
|
132
132
|
height: 100%;
|
133
|
-
opacity: .1;
|
133
|
+
opacity: 0.1;
|
134
134
|
position: absolute;
|
135
135
|
width: 100%;
|
136
136
|
}
|
@@ -176,7 +176,7 @@
|
|
176
176
|
.cropper-point {
|
177
177
|
background-color: #39f;
|
178
178
|
height: 5px;
|
179
|
-
opacity: .75;
|
179
|
+
opacity: 0.75;
|
180
180
|
width: 5px;
|
181
181
|
}
|
182
182
|
|
@@ -252,12 +252,12 @@
|
|
252
252
|
@media (min-width: 1200px) {
|
253
253
|
.cropper-point.point-se {
|
254
254
|
height: 5px;
|
255
|
-
opacity: .75;
|
255
|
+
opacity: 0.75;
|
256
256
|
width: 5px;
|
257
257
|
}
|
258
258
|
}
|
259
259
|
|
260
|
-
.cropper-point.point-se
|
260
|
+
.cropper-point.point-se::before {
|
261
261
|
background-color: #39f;
|
262
262
|
bottom: -50%;
|
263
263
|
content: ' ';
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cropper_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D1ceWard
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jquery-rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
description: Cropper is a simple image cropping library. This gem integrates Cropper
|
42
42
|
with Rails asset pipeline for ease of use.
|
43
43
|
email:
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
50
50
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
51
51
|
- ".gitignore"
|
52
|
-
- ".rubocop.yml"
|
53
52
|
- CODE_OF_CONDUCT.md
|
54
53
|
- CONTRIBUTING.md
|
55
54
|
- Gemfile
|
@@ -82,8 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
81
|
- !ruby/object:Gem::Version
|
83
82
|
version: '0'
|
84
83
|
requirements: []
|
85
|
-
|
86
|
-
rubygems_version: 2.7.7
|
84
|
+
rubygems_version: 3.1.2
|
87
85
|
signing_key:
|
88
86
|
specification_version: 4
|
89
87
|
summary: Integrate Cropper library with Rails asset pipeline
|