added default unit parameter to settings
This commit is contained in:
Vendored
+7
-5
@@ -1210,7 +1210,9 @@ function ImageEditor(canvasId, args) {
|
|||||||
dimensions: {
|
dimensions: {
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600
|
height: 600
|
||||||
}
|
},
|
||||||
|
// Default unit
|
||||||
|
unit: 'cm'
|
||||||
}, args);
|
}, args);
|
||||||
|
|
||||||
|
|
||||||
@@ -1269,14 +1271,14 @@ function ImageEditor(canvasId, args) {
|
|||||||
* Crops image to desired dimensions
|
* Crops image to desired dimensions
|
||||||
* @param {int} width [description]
|
* @param {int} width [description]
|
||||||
* @param {int} height [description]
|
* @param {int} height [description]
|
||||||
* @param {string} units cm|inch
|
* @param {string} unit cm|inch
|
||||||
* @return {ImageEditor}
|
* @return {ImageEditor}
|
||||||
*/
|
*/
|
||||||
this.crop = function (width, height, units) {
|
this.crop = function (width, height, unit) {
|
||||||
|
unit = typeof unit !== 'undefined' ? unit : _settings.unit;
|
||||||
_canvas.getImageData().removeCropData();
|
_canvas.getImageData().removeCropData();
|
||||||
|
|
||||||
_canvas.getViewport().set(width, height, units);
|
_canvas.getViewport().set(width, height, unit);
|
||||||
|
|
||||||
var shouldBeCropped = util.isAspectChanged(_canvas.getImage().width, _canvas.getImage().height, width, height);
|
var shouldBeCropped = util.isAspectChanged(_canvas.getImage().width, _canvas.getImage().height, width, height);
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function cropImage() {
|
function cropImage() {
|
||||||
editor.crop(width.value, height.value, 'cm');
|
editor.crop(width.value, height.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeEditor() {
|
function resizeEditor() {
|
||||||
|
|||||||
+7
-5
@@ -24,7 +24,9 @@ function ImageEditor(canvasId, args) {
|
|||||||
dimensions: {
|
dimensions: {
|
||||||
width: 800,
|
width: 800,
|
||||||
height: 600
|
height: 600
|
||||||
}
|
},
|
||||||
|
// Default unit
|
||||||
|
unit: 'cm'
|
||||||
}, args);
|
}, args);
|
||||||
|
|
||||||
|
|
||||||
@@ -83,14 +85,14 @@ function ImageEditor(canvasId, args) {
|
|||||||
* Crops image to desired dimensions
|
* Crops image to desired dimensions
|
||||||
* @param {int} width [description]
|
* @param {int} width [description]
|
||||||
* @param {int} height [description]
|
* @param {int} height [description]
|
||||||
* @param {string} units cm|inch
|
* @param {string} unit cm|inch
|
||||||
* @return {ImageEditor}
|
* @return {ImageEditor}
|
||||||
*/
|
*/
|
||||||
this.crop = function (width, height, units) {
|
this.crop = function (width, height, unit) {
|
||||||
|
unit = typeof unit !== 'undefined' ? unit : _settings.unit;
|
||||||
_canvas.getImageData().removeCropData();
|
_canvas.getImageData().removeCropData();
|
||||||
|
|
||||||
_canvas.getViewport().set(width, height, units);
|
_canvas.getViewport().set(width, height, unit);
|
||||||
|
|
||||||
var shouldBeCropped = util.isAspectChanged(_canvas.getImage().width, _canvas.getImage().height, width, height);
|
var shouldBeCropped = util.isAspectChanged(_canvas.getImage().width, _canvas.getImage().height, width, height);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user