Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix wrong test of width with height #896

Merged
merged 1 commit into from
May 2, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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