Rapid updates cause gauge value to be incorrect.

Issue #15 resolved
Patrick Kutch
created an issue

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)

  1. Patrick Kutch reporter

    I have a fix for this. Change goes in both GaugeSkin.java and SimpleGaugeSkin.java in the rotateNeedle() function:

        //double targetAngle = needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep;
        double targetAngle = 180 - getSkinnable().getStartAngle() + getSkinnable().getValue() * angleStep; // Fix by P. Kutch for issue #15
    
  2. Log in to comment