Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -655,15 +655,20 @@ public double getRelX() {
* @throws IllegalArgumentException if relX is not between -1.0 and 1.0. t
*/
public void setRelX(double v) {
if (Math.abs(v) <= 1.0) {
if (relX != v) {
relX = v;
updateCoordinates();
fireObjectModifiedEvent(PathwayObjectEvent.createCoordinatePropertyEvent(this));
}
} else {
throw new IllegalArgumentException("relX " + v + " should be between -1.0 and 1.0");
//Fix: instead off throwing an exception, clamping the value to the valid range and print a warning message.
if (v<-1.0) {
v = -1.0;
System.out.println("Warning: relX value clamped to -1.0");
}
else if (v>1.0) {
v = 1.0;
System.out.println("Warning: relX value clamped to 1.0");
}
if (relX != v) {
relX = v;
updateCoordinates();
fireObjectModifiedEvent(PathwayObjectEvent.createCoordinatePropertyEvent(this));
}
}

/**
Expand All @@ -687,14 +692,20 @@ public double getRelY() {
* @param v the relative y coordinate.
*/
public void setRelY(double v) {
if (Math.abs(v) <= 1.0) {
if (relY != v) {
relY = v;
updateCoordinates();
fireObjectModifiedEvent(PathwayObjectEvent.createCoordinatePropertyEvent(this));
}
} else {
throw new IllegalArgumentException("relY " + v + " should be between -1.0 and 1.0");

//Fix: instead off throwing an exception, clamping the value to the valid range and print a warning message.
if (v<-1.0) {
v = -1.0;
System.out.println("Warning: relY value clamped to -1.0");
}
else if (v>1.0) {
v = 1.0;
System.out.println("Warning: relY value clamped to 1.0");
}
if (relY != v) {
relY = v;
updateCoordinates();
fireObjectModifiedEvent(PathwayObjectEvent.createCoordinatePropertyEvent(this));
}
}

Expand Down