X-Git-Url: http://www2.svjatoslav.eu/gitweb/?p=sixth-3d.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2Fhumaninput%2FHIDInputTracker.java;fp=src%2Fmain%2Fjava%2Feu%2Fsvjatoslav%2Fsixth%2Fe3d%2Fgui%2Fhumaninput%2FHIDInputTracker.java;h=a63c33b3e624c22dfca4a0e187a536a20b52a090;hp=af0ae3104fa42dfe325ea2e4e0bb5a533ea52cf4;hb=a377e3094d304bbc815b36edc2eb303ec023ea48;hpb=8aa50f568d2edcfe974ceed4192158951e7f3215 diff --git a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java index af0ae31..a63c33b 100755 --- a/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java +++ b/src/main/java/eu/svjatoslav/sixth/e3d/gui/humaninput/HIDInputTracker.java @@ -17,29 +17,25 @@ import java.util.List; import java.util.Map; /** - * Human input device input tracker. - *

- * Idea is to capture all keyboard and mouse inputs from underlying operating system in this class - * and forward those as needed to subsequent virtual components. + * This class is responsible for tracking human input devices (keyboard, mouse, etc.) and + * forwarding those inputs to subsequent virtual components. */ public class HIDInputTracker implements MouseMotionListener, KeyListener, MouseListener, MouseWheelListener, ViewRenderListener { /** - *

-     * Key is keyboard key code.
-     * Value is system milliseconds when key was pressed.
-     *
-     * So by reading the map one can determine currently pressed keys as well as duration.
-     * 
+ *

Map of pressed keys.

+ *

Key is mouse button code.

+ *

Value is system milliseconds when button was pressed.

+ *

So by reading the map one can determine currently pressed buttons as well as duration.

*/ private final Map pressedKeysToPressedTimeMap = new HashMap<>(); private final List detectedMouseEvents = new ArrayList<>(); private final List detectedKeyEvents = new ArrayList<>(); private int wheelMovedDirection = 0; - private Point2D mouseDraggedDirection = new Point2D(); + private final Point2D mouseDraggedDirection = new Point2D(); private Point2D oldMouseCoordinatesWhenDragging; - private ViewPanel viewPanel; + private final ViewPanel viewPanel; private Point2D currentMouseLocation; private boolean mouseMoved; private boolean mouseWithinWindow = false;