From 899bbc2dbc5802f44937b388442ebfdab927ed7e Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Wed, 13 May 2015 10:06:54 -0700 Subject: [PATCH] Fixed: issue with determinate spinning progressBar annd value not between 0 and 100 --- AppKit/CPProgressIndicator.j | 2 +- Tests/Manual/CPProgressIndicator/AppController.j | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/AppKit/CPProgressIndicator.j b/AppKit/CPProgressIndicator.j index c75ef0d66..7f9b9afb4 100644 --- a/AppKit/CPProgressIndicator.j +++ b/AppKit/CPProgressIndicator.j @@ -461,7 +461,7 @@ var CPProgressIndicatorSpinningStyleColors = []; { var midX = CGRectGetMidX(rect), midY = CGRectGetMidY(rect), - endAngle = Math.PI * 2 * ([self doubleValue] / ([self maxValue] - [self minValue])) - Math.PI / 2, + endAngle = Math.PI * 2 * (([self doubleValue] - [self minValue]) / ([self maxValue] - [self minValue])) - Math.PI / 2, radius = MIN(rect.size.width / 2, rect.size.height / 2) CGContextBeginPath(context); diff --git a/Tests/Manual/CPProgressIndicator/AppController.j b/Tests/Manual/CPProgressIndicator/AppController.j index 643ecd1c5..410a94614 100644 --- a/Tests/Manual/CPProgressIndicator/AppController.j +++ b/Tests/Manual/CPProgressIndicator/AppController.j @@ -36,7 +36,10 @@ [fiftyPercentBar setDoubleValue:50]; [hundredPercentBar setDoubleValue:100]; - [twentyPercentCircular setDoubleValue:20]; + [twentyPercentCircular setMaxValue:200]; + [twentyPercentCircular setMinValue:50]; + [twentyPercentCircular setDoubleValue:80]; + [fiftyPercentCircular setDoubleValue:50]; [hundredPercentCircular setDoubleValue:100];