Added: #2412 Show coordinates on stage mouse move for up to 2 decimal places

This commit is contained in:
Jindra Petřík
2025-05-25 15:39:21 +02:00
parent 9880555280
commit 7af21292b4
2 changed files with 9 additions and 7 deletions

View File

@@ -325,7 +325,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
private int hilightEdgeColorStep = 10;
private int hilightEdgeColor = 0;
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.00");
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.##");
private JScrollBar horizontalScrollBar;
private JScrollBar verticalScrollBar;
@@ -5198,7 +5198,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
MouseEvent lastMouseEvent;
int frame;
int time;
Point cursorPosition;
Point2D cursorPosition;
int mouseButton;
List<Integer> selectedDepths;
Zoom zoom;
@@ -5222,8 +5222,8 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
cursorPosition = this.cursorPosition;
if (cursorPosition != null) {
Point2D p2d = toTransformPoint(cursorPosition);
//p2d = getParentMatrix().inverse().transform(p2d);
cursorPosition = new Point((int) Math.round(p2d.getX() / SWF.unitDivisor), (int) Math.round(p2d.getY() / SWF.unitDivisor));
//p2d = getParentMatrix().inverse().transform(p2d);
cursorPosition = new Point2D.Double(p2d.getX() / SWF.unitDivisor, p2d.getY() / SWF.unitDivisor);
}
mouseButton = this.mouseButton;
@@ -5244,7 +5244,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
if (cursorPosition != null) { // && (!doFreeTransform || transformSelectionMode)) {
DisplayPoint touchPoint = new DisplayPoint(cursorPosition);
if (touchPointOffset != null) {
touchPoint = new DisplayPoint(cursorPosition.x + touchPointOffset.x, cursorPosition.y + touchPointOffset.y);
touchPoint = new DisplayPoint((int) Math.round(cursorPosition.getX() + touchPointOffset.x), (int) Math.round(cursorPosition.getY() + touchPointOffset.y));
}
renderContext.cursorPosition = new Point((int) (touchPoint.x * SWF.unitDivisor), (int) (touchPoint.y * SWF.unitDivisor));
@@ -5393,7 +5393,7 @@ public final class ImagePanel extends JPanel implements MediaDisplay {
StringBuilder ret = new StringBuilder();
if (cursorPosition != null && autoPlayed) {
ret.append(" [").append(cursorPosition.x).append(",").append(cursorPosition.y).append("]");
ret.append(" [").append(formatDouble(cursorPosition.getX() )).append(";").append(formatDouble(cursorPosition.getY())).append("]");
if (showObjectsUnderCursor) {
ret.append(" : ");
}