@lemonadejs/cropper 1.5.1 → 1.6.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.
- package/dist/cropper.js +19 -18
- package/package.json +2 -2
package/dist/cropper.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* (c) LemonadeJS components
|
|
3
3
|
*
|
|
4
4
|
* Website: https://lemonadejs.net
|
|
5
|
-
* Description: Image cropper v1.
|
|
5
|
+
* Description: Image cropper v1.5.2
|
|
6
6
|
*
|
|
7
7
|
* MIT License
|
|
8
8
|
*
|
|
@@ -11,7 +11,7 @@
|
|
|
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.
|
|
14
|
+
global.Cropper = factory();
|
|
15
15
|
}(this, (function () {
|
|
16
16
|
|
|
17
17
|
'use strict';
|
|
@@ -34,16 +34,18 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if (typeof(
|
|
38
|
-
if (typeof(
|
|
39
|
-
var
|
|
40
|
-
} else if (window.
|
|
41
|
-
var
|
|
37
|
+
if (typeof(cropper) == 'undefined') {
|
|
38
|
+
if (typeof(Crop) === 'function') {
|
|
39
|
+
var Crop = require('@jsuites/cropper');
|
|
40
|
+
} else if (window.cropper) {
|
|
41
|
+
var Crop = window.cropper;
|
|
42
42
|
}
|
|
43
|
+
} else {
|
|
44
|
+
var Crop = cropper;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
47
|
return (function() {
|
|
46
|
-
var self =
|
|
48
|
+
var self = this;
|
|
47
49
|
var original = self.original ? 1 : 0;
|
|
48
50
|
var width = self.width || 300;
|
|
49
51
|
var height = self.height || 240;
|
|
@@ -76,7 +78,7 @@
|
|
|
76
78
|
var a = [798, 360];
|
|
77
79
|
var c = [width, height];
|
|
78
80
|
}
|
|
79
|
-
crop =
|
|
81
|
+
crop = Crop(o, {
|
|
80
82
|
area: a,
|
|
81
83
|
crop: c ,
|
|
82
84
|
allowResize: false,
|
|
@@ -163,13 +165,11 @@
|
|
|
163
165
|
newImage.src = filename;
|
|
164
166
|
// Integration with jSuites.form
|
|
165
167
|
if (self.name) {
|
|
166
|
-
//self.el.content = [data];
|
|
167
|
-
|
|
168
168
|
newImage.classList.remove('jfile');
|
|
169
|
-
} else {
|
|
170
|
-
// Legacy
|
|
171
|
-
newImage.content = data;
|
|
172
169
|
}
|
|
170
|
+
// Value
|
|
171
|
+
self.value = [data];
|
|
172
|
+
// Append new image
|
|
173
173
|
self.image.appendChild(newImage);
|
|
174
174
|
}
|
|
175
175
|
// Create image
|
|
@@ -255,14 +255,14 @@
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
self.onload = function() {
|
|
258
|
-
self.image.style.
|
|
259
|
-
self.image.style.
|
|
258
|
+
self.image.style.maxWidth = self.width + 'px';
|
|
259
|
+
self.image.style.maxHeight = self.height + 'px';
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
// Template
|
|
263
263
|
var template = `
|
|
264
264
|
<div name="{{self.name}}" value="{{self.value}}">
|
|
265
|
-
<div @ref='self.image' class="jphoto"></div>
|
|
265
|
+
<div @ref='self.image' class="jphoto jcropper"></div>
|
|
266
266
|
<div @ready='self.createModal(this)'>
|
|
267
267
|
<div @ready='self.createCropper(this)' @ref='self.cropperArea'></div>
|
|
268
268
|
<div @ready='self.createControls(this)' class="controls">
|
|
@@ -303,7 +303,8 @@
|
|
|
303
303
|
var root = lemonade.element(template, self);
|
|
304
304
|
|
|
305
305
|
// Onclick event
|
|
306
|
-
root.addEventListener('
|
|
306
|
+
root.addEventListener('mousedown', function(e) {
|
|
307
|
+
|
|
307
308
|
e = e || window.event;
|
|
308
309
|
if (e.buttons) {
|
|
309
310
|
var mouseButton = e.buttons;
|
package/package.json
CHANGED