Rapid updates cause gauge value to be incorrect.
To reproduce, modify DemoGauge.jave animation timer section to be:
timer = new AnimationTimer() { @Override public void handle(long now) { if (now > lastTimerCall + 2_000_000_000) { double newVal = RND.nextDouble() * 100; control.setValue(newVal); System.out.println(Double.toString(newVal)+ " : " + control.getValue()); control.setValue(90); control.setValue(100); control.setValue(200); control.setValue(3); control.setValue(newVal); lastTimerCall = now; } } }; timer.start();
If I do control.setAnimated(false), the gauge is accurate, so likely similar to other issue about updates happening faster than animation rate.
Comments (2)
-
reporter -
repo owner - changed status to resolved
Applied the suggested fix from Patrick Kutch and it seems to work :)
- Log in to comment
I have a fix for this. Change goes in both GaugeSkin.java and SimpleGaugeSkin.java in the rotateNeedle() function: