From 905ab44665cb72ddb976234d4130677b706bed2c Mon Sep 17 00:00:00 2001 From: kangax Date: Fri, 10 Feb 2012 00:13:09 -0500 Subject: [PATCH] Remove unused functionality in `fabric.Image` (maxwidth/maxheight). If we do add this in the future, it should really be on `fabric.Object` not only on `fabric.Image`. --- src/image.class.js | 47 ---------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/src/image.class.js b/src/image.class.js index a753fe05..5a759512 100644 --- a/src/image.class.js +++ b/src/image.class.js @@ -26,18 +26,6 @@ */ fabric.Image = fabric.util.createClass(fabric.Object, /** @scope fabric.Image.prototype */ { - /** - * @property - * @type Number - */ - maxwidth: null, - - /** - * @property - * @type Number - */ - maxheight: null, - /** * @property * @type Boolean @@ -110,41 +98,6 @@ return this; }, - /** - * Resizes an image depending on whether maxwidth and maxheight are set up; - * Width and height have to mantain the same proportion in the final image as it was in the initial one. - * @method getNormalizedSize - * @param {Object} oImg - * @param {Number} maxwidth maximum width of the image (in px) - * @param {Number} maxheight maximum height of the image (in px) - */ - getNormalizedSize: function(oImg, maxwidth, maxheight) { - if (maxheight && maxwidth && (oImg.width > oImg.height && (oImg.width / oImg.height) < (maxwidth / maxheight))) { - // height is the constraining dimension. - normalizedWidth = ~~((oImg.width * maxheight) / oImg.height); - normalizedHeight = maxheight; - } - else if (maxheight && ((oImg.height == oImg.width) || (oImg.height > oImg.width) || (oImg.height > maxheight))) { - // height is the constraining dimension. - normalizedWidth = ~~((oImg.width * maxheight) / oImg.height); - normalizedHeight = maxheight; - } - else if (maxwidth && (maxwidth < oImg.width)) { - // width is the constraining dimension. - normalizedHeight = ~~((oImg.height * maxwidth) / oImg.width); - normalizedWidth = maxwidth; - } - else { - normalizedWidth = oImg.width; - normalizedHeight = oImg.height; - } - - return { - width: normalizedWidth, - height: normalizedHeight - }; - }, - /** * Returns original size of an image * @method getOriginalSize