|
@@ -15,8 +15,16 @@ window.onload = function () {
|
|
var dataScaleX = document.getElementById('dataScaleX');
|
|
var dataScaleX = document.getElementById('dataScaleX');
|
|
var dataScaleY = document.getElementById('dataScaleY');
|
|
var dataScaleY = document.getElementById('dataScaleY');
|
|
|
|
|
|
|
|
+ var dataX_text = document.getElementById('dataX_text');
|
|
|
|
+ var dataY_text = document.getElementById('dataY_text');
|
|
|
|
+ var dataHeight_text = document.getElementById('dataHeight_text');
|
|
|
|
+ var dataWidth_text = document.getElementById('dataWidth_text');
|
|
|
|
+ var dataRotate_text = document.getElementById('dataRotate_text');
|
|
|
|
+ var dataScaleX_text = document.getElementById('dataScaleX_text');
|
|
|
|
+ var dataScaleY_text = document.getElementById('dataScaleY_text');
|
|
|
|
+
|
|
var options = {
|
|
var options = {
|
|
- aspectRatio: 16 / 9,
|
|
|
|
|
|
+ aspectRatio: aspectRatioValue,
|
|
preview: '.img-preview',
|
|
preview: '.img-preview',
|
|
ready: function (e) {
|
|
ready: function (e) {
|
|
//console.log(e.type);
|
|
//console.log(e.type);
|
|
@@ -53,6 +61,14 @@ window.onload = function () {
|
|
dataRotate.value = typeof data.rotate !== 'undefined' ? data.rotate : '';
|
|
dataRotate.value = typeof data.rotate !== 'undefined' ? data.rotate : '';
|
|
dataScaleX.value = typeof data.scaleX !== 'undefined' ? data.scaleX : '';
|
|
dataScaleX.value = typeof data.scaleX !== 'undefined' ? data.scaleX : '';
|
|
dataScaleY.value = typeof data.scaleY !== 'undefined' ? data.scaleY : '';
|
|
dataScaleY.value = typeof data.scaleY !== 'undefined' ? data.scaleY : '';
|
|
|
|
+
|
|
|
|
+ dataX_text.innerHTML = dataX.value;
|
|
|
|
+ dataY_text.innerHTML = dataY.value;
|
|
|
|
+ dataHeight_text.innerHTML = dataHeight.value;
|
|
|
|
+ dataWidth_text.innerHTML = dataWidth.value;
|
|
|
|
+ dataRotate_text.innerHTML = dataRotate.value;
|
|
|
|
+ dataScaleX_text.innerHTML = dataScaleX.value;
|
|
|
|
+ dataScaleY_text.innerHTML = dataScaleY.value;
|
|
},
|
|
},
|
|
zoom: function (e) {
|
|
zoom: function (e) {
|
|
//console.log(e.type, e.detail.ratio);
|
|
//console.log(e.type, e.detail.ratio);
|
|
@@ -218,8 +234,12 @@ window.onload = function () {
|
|
|
|
|
|
case 'aspectRatio':
|
|
case 'aspectRatio':
|
|
cropper.destroy();
|
|
cropper.destroy();
|
|
- var tmp = data.value.split(':');
|
|
|
|
- options.aspectRatio = tmp[0]/tmp[1];
|
|
|
|
|
|
+ if (data.value.indexOf(':') == -1) {
|
|
|
|
+ options.aspectRatio = data.value;
|
|
|
|
+ } else {
|
|
|
|
+ var tmp = data.value.split(':');
|
|
|
|
+ options.aspectRatio = tmp[0]/tmp[1];
|
|
|
|
+ }
|
|
cropper = new Cropper(image, options);
|
|
cropper = new Cropper(image, options);
|
|
|
|
|
|
break;
|
|
break;
|