Improved code readability. Components now aware of what mouse button was clicked.
[sixth-3d.git] / src / main / java / eu / svjatoslav / sixth / e3d / renderer / raster / shapes / basic / solidpolygon / SolidPolygon.java
index e45a991..87143b5 100644 (file)
@@ -1,22 +1,18 @@
 /*
- * Sixth 3D engine. Copyright ©2012-2018, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of version 3 of the GNU Lesser General Public License
- * or later as published by the Free Software Foundation.
- *
+ * Sixth 3D engine. Author: Svjatoslav Agejenko. 
+ * This project is released under Creative Commons Zero (CC0) license.
  */
-
 package eu.svjatoslav.sixth.e3d.renderer.raster.shapes.basic.solidpolygon;
 
 import eu.svjatoslav.sixth.e3d.geometry.Point2D;
 import eu.svjatoslav.sixth.e3d.geometry.Point3D;
-import eu.svjatoslav.sixth.e3d.geometry.Polygon;
 import eu.svjatoslav.sixth.e3d.gui.RenderingContext;
 import eu.svjatoslav.sixth.e3d.gui.humaninput.MouseInteractionController;
 import eu.svjatoslav.sixth.e3d.renderer.raster.Color;
 import eu.svjatoslav.sixth.e3d.renderer.raster.shapes.AbstractCoordinateShape;
 
+import static eu.svjatoslav.sixth.e3d.geometry.Polygon.pointWithinPolygon;
+
 public class SolidPolygon extends AbstractCoordinateShape {
 
     private final static LineInterpolator polygonBoundary1 = new LineInterpolator();
@@ -103,10 +99,10 @@ public class SolidPolygon extends AbstractCoordinateShape {
         onScreenPoint3.roundToInteger();
 
         if (mouseInteractionController != null)
-            if (context.mouseEvent != null)
-                if (Polygon.pointWithinPolygon(context.mouseEvent.coordinate,
+            if (context.getMouseEvent() != null)
+                if (pointWithinPolygon(context.getMouseEvent().coordinate,
                         onScreenPoint1, onScreenPoint2, onScreenPoint3))
-                    context.objectUnderMouse = mouseInteractionController;
+                    context.setCurrentObjectUnderMouseCursor(mouseInteractionController);
 
         if (color.isTransparent())
             return;