Skip to content

Commit

Permalink
fix wrong test of width with height (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
emassip committed May 2, 2020
1 parent c13e448 commit 0fe3292
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ private UploadBase64FileModification rasterizeSVG(UploadBase64FileModification u

final SVGUniverse uni = new SVGUniverse();
final URI uri = uni.loadSVG(upload.getInputStream(), "_");
// use apply 10% margin to prevent final image size to exceed max allowed size
//apply 10% margin to prevent final image size to exceed max allowed size
final int maxWidthWithMargin = (int) (IMAGE_THUMB_MAX_WIDTH_PX * 0.9);
final int maxHeightWithMargin = (int) (IMAGE_THUMB_MAX_HEIGHT_PX * 0.9);

final SVGIcon icon = new SVGIcon();
icon.setSvgUniverse(uni);
icon.setSvgURI(uri);
icon.setAntiAlias(true);
if(icon.getIconWidth() > maxHeightWithMargin || icon.getIconHeight() > maxHeightWithMargin) {
if(icon.getIconWidth() > maxWidthWithMargin || icon.getIconHeight() > maxHeightWithMargin) {
icon.setAutosize(SVGIcon.AUTOSIZE_STRETCH);
icon.setPreferredSize(new Dimension(Math.min(maxWidthWithMargin, icon.getIconWidth()), Math.min(maxHeightWithMargin, icon.getIconHeight())));
}
Expand Down

0 comments on commit 0fe3292

Please sign in to comment.