Skip to content

Commit 2a88ce3

Browse files
author
Alexander1248
committed
Bug Fix
1 parent 708a313 commit 2a88ce3

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>ru.alexander</groupId>
88
<artifactId>BodyTreckering</artifactId>
9-
<version>1.0</version>
9+
<version>1.11</version>
1010

1111
<properties>
1212
<maven.compiler.source>18</maven.compiler.source>

src/main/java/ru/alexander/App.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public static void main(String[] args) {
1515
new Source(30, 30, 10)
1616
};
1717
Tracker[] trackers = { new Tracker() };
18-
trackers[0].x = 13;
19-
trackers[0].y = 5;
18+
trackers[0].x = 15;
19+
trackers[0].y = 15;
2020
trackers[0].z = 5;
2121
Window window = new Window(sources, trackers);
2222
}

src/main/java/ru/alexander/window/Window.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ public void mouseWheelMoved(MouseWheelEvent e) {
9191
public void mousePressed(MouseEvent e) {
9292
sx = e.getX();
9393
sy = e.getY();
94-
for (int i = 0; i < Window.this.sources.length; i++) {
95-
if (Math.sqrt(Math.pow(Window.this.sources[i].x * scale + x - sx, 2)
96-
+ Math.pow(Window.this.sources[i].y * scale + y - sy, 2)) < 0.7 * scale) {
97-
selected = Window.this.sources[i];
94+
for (int i = 0; i < Window.this.trackers.length; i++) {
95+
if (Math.sqrt(Math.pow(Window.this.trackers[i].x * scale + x - sx, 2)
96+
+ Math.pow(Window.this.trackers[i].y * scale + y - sy, 2)) < 0.7 * scale) {
97+
selected = Window.this.trackers[i];
9898
break;
9999
}
100100
}
101101
if (selected == null) {
102-
for (int i = 0; i < Window.this.trackers.length; i++) {
103-
if (Math.sqrt(Math.pow(Window.this.trackers[i].x * scale + x - sx, 2)
104-
+ Math.pow(Window.this.trackers[i].y * scale + y - sy, 2)) < 0.7 * scale) {
105-
selected = Window.this.trackers[i];
102+
for (int i = 0; i < Window.this.sources.length; i++) {
103+
if (Math.sqrt(Math.pow(Window.this.sources[i].x * scale + x - sx, 2)
104+
+ Math.pow(Window.this.sources[i].y * scale + y - sy, 2)) < 0.7 * scale) {
105+
selected = Window.this.sources[i];
106106
break;
107107
}
108108
}

0 commit comments

Comments
 (0)