Commit 8c3c1a4d authored by Eric Tobias's avatar Eric Tobias

2.1.0 - Fixed error where positions were not checked for screencoordinates...

2.1.0 - Fixed error where positions were not checked for screencoordinates resulting in inconsistent comparisons.
parent f4e1739e
......@@ -42,7 +42,6 @@ public class SpatialMatrix {
* The object to add.
*/
public void add(TangibleObject object) {
object.getPosition().toScreenCoordinates();
horizontal.add(findHorizontalIndexFor(object), object);
vertical.add(findVerticalIndexFor(object), object);
}
......@@ -84,7 +83,7 @@ public class SpatialMatrix {
*/
private int findHorizontalIndexFor(TangibleObject object) {
for (int index = 0; index < horizontal.size(); index++) {
if (Double.compare(object.getPosition().getX(), horizontal.get(index).getPosition().getX()) <= 0) {
if (Double.compare(object.getPosition().toScreenCoordinates().getX(), horizontal.get(index).getPosition().toScreenCoordinates().getX()) <= 0) {
return index;
}
}
......@@ -103,7 +102,7 @@ public class SpatialMatrix {
*/
private int findVerticalIndexFor(TangibleObject object) {
for (int index = 0; index < vertical.size(); index++) {
if (Double.compare(object.getPosition().getY(), vertical.get(index).getPosition().getY()) <= 0) {
if (Double.compare(object.getPosition().toScreenCoordinates().getY(), vertical.get(index).getPosition().toScreenCoordinates().getY()) <= 0) {
return index;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment