Show mouse position in the status bar

This commit is contained in:
Branislav Stojkovic
2019-02-08 09:56:48 +01:00
parent fbf2569a7e
commit 0cb4377830
6 changed files with 69 additions and 12 deletions
@@ -85,7 +85,8 @@ public enum EventType {
AVAILABLE_CTRL_POINTS_CHANGED,
/**
* Called when mouse cursor is moved. Point object is passed, containing the current cursor
* location (not taking zoom into account).
* location (not taking zoom into account) in pixels and two {@link Point2D} objects with coordinates in
* inches and mm
*/
MOUSE_MOVED,
/**
@@ -861,8 +861,11 @@ public class Presenter implements IPlugInPort {
}
}
}
Point2D inPoint = new Point2D.Double(1.0d * previousScaledPoint.x / Constants.PIXELS_PER_INCH, 1.0d * previousScaledPoint.y / Constants.PIXELS_PER_INCH);
Point2D mmPoint = new Point2D.Double(inPoint.getX() * SizeUnit.in.getFactor() / SizeUnit.cm.getFactor() * 10d, inPoint.getY() * SizeUnit.in.getFactor() / SizeUnit.cm.getFactor() * 10d);
messageDispatcher.dispatchMessage(EventType.MOUSE_MOVED, previousScaledPoint);
messageDispatcher.dispatchMessage(EventType.MOUSE_MOVED, previousScaledPoint, inPoint, mmPoint);
if (!components.equals(controlPointMap)) {
controlPointMap = components;