SubmodelComponent now reports rounded coordinates, too
[Mograsim.git] / net.mograsim.logic.ui / src / net / mograsim / logic / ui / model / components / SubmodelComponent.java
index 6e838a5..7dceec8 100644 (file)
@@ -174,6 +174,18 @@ public class SubmodelComponent extends GUIComponent
                return mapMin + (val - valMin) * (mapMax - mapMin) / (valMax - valMin);
        }
 
+       @Override
+       public boolean clicked(double x, double y)
+       {
+               // TODO
+               double scaledX = (x - getBounds().x) / submodelScale;
+               double scaledY = (y - getBounds().y) / submodelScale;
+               double roundedScaledX = Math.round(scaledX / 5 * 2) * 5 / 2.;
+               double roundedScaledY = Math.round(scaledY / 5 * 2) * 5 / 2.;
+               System.out.println(scaledX + "|" + scaledY + ", rounded " + roundedScaledX + "|" + roundedScaledY);
+               return true;
+       }
+
        private static class PinMovable extends Pin
        {
                public PinMovable(GUIComponent component, int logicWidth, double relX, double relY)