Commit cd7fb3bf authored by Nico Mack's avatar Nico Mack
Browse files

Fixed minor bugs with upper and lower Stop angle not being correctly

used to determine current position
parent f1e0a0b2
......@@ -131,7 +131,9 @@ public class SelectorWidget extends ValueWidget {
// ---------------------------------------------------------------------------
protected int getCurrentPosition(float newAngle) {
double segment = TWO_PI / numberOfPositions;
double range = (constrainted) ? Math.toRadians(upperStopAngle - lowerStopAngle) : TWO_PI;
double segment = range / numberOfPositions;
int current = 0;
float angle = (float) AngleUtils.moduloTwoPi(newAngle);
......
......@@ -110,8 +110,8 @@ public class ValueWidget extends TetherableWidget implements InformationProvider
public ValueWidget(BaseValueWidgetBuilder<?> builder) {
super(builder);
this.lowerBound = builder.lowerBound;
this.upperBound = builder.upperBound;
this.lowerBound = Math.min(builder.lowerBound, builder.upperBound);
this.upperBound = Math.max(builder.lowerBound, builder.upperBound);
this.lowerStopAngle = builder.lowerStopAngle;
this.upperStopAngle = builder.upperStopAngle;
this.stepSize = builder.stepSize;
......
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