added default unit parameter to settings
This commit is contained in:
+7
-5
@@ -24,7 +24,9 @@ function ImageEditor(canvasId, args) {
|
||||
dimensions: {
|
||||
width: 800,
|
||||
height: 600
|
||||
}
|
||||
},
|
||||
// Default unit
|
||||
unit: 'cm'
|
||||
}, args);
|
||||
|
||||
|
||||
@@ -83,14 +85,14 @@ function ImageEditor(canvasId, args) {
|
||||
* Crops image to desired dimensions
|
||||
* @param {int} width [description]
|
||||
* @param {int} height [description]
|
||||
* @param {string} units cm|inch
|
||||
* @param {string} unit cm|inch
|
||||
* @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.getViewport().set(width, height, units);
|
||||
_canvas.getViewport().set(width, height, unit);
|
||||
|
||||
var shouldBeCropped = util.isAspectChanged(_canvas.getImage().width, _canvas.getImage().height, width, height);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user