Updated image editor with not having to crop again after resizing
This commit is contained in:
+5
-11
@@ -23,20 +23,14 @@
|
||||
Event.handleResize();
|
||||
});
|
||||
|
||||
function getOptimalDimension(currentDimension, ratio) {
|
||||
var width = $input.w.val();
|
||||
var height = $input.h.val();
|
||||
|
||||
function getOptimalDimension(values, currentDimension, ratio) {
|
||||
if (currentDimension === 'h') {
|
||||
width = Math.round(height / ratio);
|
||||
values.width = Math.round(values.height * ratio);
|
||||
} else {
|
||||
height = Math.round(width / ratio);
|
||||
values.height = Math.round(values.width / ratio);
|
||||
}
|
||||
|
||||
return {
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
return values;
|
||||
}
|
||||
|
||||
var Event = {
|
||||
@@ -70,7 +64,7 @@
|
||||
handleResize: function() {
|
||||
var isFullScreen = document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement;
|
||||
var width = $wrapper.width();
|
||||
var height = isFullScreen ? $window.height() : $wrapper.height();
|
||||
var height = isFullScreen ? ($window.height() < 800 ? $window.height() : 800) : $wrapper.height();
|
||||
editor.canvas.resize({width: width, height: height});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user