From: jsimomaa Date: Fri, 31 Jan 2020 09:59:32 +0000 (+0200) Subject: Diagram element calculateScaleRecip should never return 0 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F3833%2F1;p=simantics%2Fdistrict.git Diagram element calculateScaleRecip should never return 0 gitlab #78 Change-Id: Ie8a71822f7b0a8d2d8a0d9720a825fc8a59cf51f (cherry picked from commit 6b176202f7acfdbea0d23b4b1d56737cdc41a624) --- diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java index 09224291..182176d2 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java @@ -49,6 +49,8 @@ public class DistrictNetworkNodeUtils { public static double calculateScaleRecip(AffineTransform tr) { int zoomLevel = MapScalingTransform.zoomLevel(tr); + if (zoomLevel == 0) + zoomLevel = 1; return 1.0 / (getScale(tr) * Math.sqrt(zoomLevel)); }