]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Prevent scaling of vertices in zoom levels > 15
authorjsimomaa <jani.simomaa@gmail.com>
Mon, 22 Apr 2019 18:07:46 +0000 (21:07 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 31 Aug 2019 20:08:36 +0000 (23:08 +0300)
gitlab #35
APROS-15329

Change-Id: I8797d241c3ce59031851e6e74c66c0f4907783b7

org.simantics.district.network.ui/src/org/simantics/district/network/ui/nodes/DistrictNetworkNodeUtils.java

index 21e49b58277c8f93334ddcf1ccf6428363f278dc..c9e4a00e19b3be532b23f2d4641590e953bb9524 100644 (file)
@@ -39,7 +39,13 @@ public class DistrictNetworkNodeUtils {
 
     public static double calculateScaleRecip(AffineTransform tr) {
         int zoomLevel = MapScalingTransform.zoomLevel(tr);
-        double t = 1.0 / (getScale(tr) * Math.sqrt(zoomLevel));
+        double t;
+        if (zoomLevel > 15) {
+            int d = zoomLevel - 15; // stop zooming vertices when zoom level > 15
+            t = 1.0 / d / (getScale(tr) * Math.sqrt(zoomLevel));
+        } else {
+            t = 1.0 / (getScale(tr) * Math.sqrt(zoomLevel));
+        }
         return t;
     }