From 29264c6efb3693a000f57bbe9e1405bcb8215690 Mon Sep 17 00:00:00 2001 From: JoelIF Date: Sun, 6 Jan 2019 17:47:10 -0200 Subject: [PATCH] Change the behavior of bounds.height "percent" It makes the bound.height "percentage" to be a percentage of the parent.clientHeight instead of a percentage of the bounds.width. --- dist/tinycrop.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/tinycrop.js b/dist/tinycrop.js index 59ac6ca..7baca06 100644 --- a/dist/tinycrop.js +++ b/dist/tinycrop.js @@ -198,7 +198,7 @@ return /******/ (function(modules) { // webpackBootstrap if (isInteger(boundsHeight)) { height = boundsHeight; } else if (isPercent(boundsHeight)) { - height = Math.round(width * getPercent(boundsHeight) / 100); + height = Math.round(parent.clientHeight * getPercent(boundsHeight) / 100); } else if (image && image.hasLoaded && isAuto(boundsHeight)) { height = Math.floor(width / image.getAspectRatio()); } else { @@ -1737,4 +1737,4 @@ return /******/ (function(modules) { // webpackBootstrap /***/ } /******/ ]) }); -; \ No newline at end of file +;