Skip to content

Commit

Permalink
fix: TActivityBar.HorizontalSpace working incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
errorcalc committed Dec 17, 2016
1 parent bf892e3 commit 9bb0703
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Source/ES.Indicators.pas
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ function TEsActivityBar.GetStartPos: double;
begin
case AnimationType of
TActivityAnimationType.Bar:
Result := (FillWidth * -0.5) / ClientWidth;
Result := (FillWidth * -0.5) / (ClientWidth - HorizontalSpace * 2);
TActivityAnimationType.Sin:
Result := -pi * 1;
TActivityAnimationType.WindowsX:
Expand Down Expand Up @@ -460,14 +460,16 @@ function TEsActivityBar.GetAnimationEnergy: TAnimationEnergy;
function TEsActivityBar.GetScreenPos(X: Double; Number: Integer): Integer;
var
k: Integer;
w: Integer;
begin
w := ClientWidth - HorizontalSpace * 2;
if AnimationType = TActivityAnimationType.Sin then
k := 4
else
k := 1;
Result :=
GetPointPos(
((k * FPointSpace + PointWidth) * (Number - (FPointCount - 1) * 0.5)) / ClientWidth + X, ClientWidth);
HorizontalSpace + GetPointPos(
((k * FPointSpace + PointWidth) * (Number - (FPointCount - 1) * 0.5)) / w + X, w);
end;

function TEsActivityBar.FillWidth: Integer;
Expand Down Expand Up @@ -555,6 +557,8 @@ procedure TEsActivityBar.Paint;
end;
end else
begin
if HorizontalSpace <> 0 then
IntersectClipRect(Canvas.Handle, HorizontalSpace, 0, ClientWidth - HorizontalSpace, ClientHeight);
if PointType = TActivityPointType.Circle then
begin
Graphics := TGPGraphics.Create(Canvas.Handle);
Expand All @@ -570,7 +574,7 @@ procedure TEsActivityBar.Paint;
begin
x := GetScreenPos(Pos, i);

R.Left := x - PointWidth div 2 + HorizontalSpace;
R.Left := x - PointWidth div 2;
R.Top := FVerticalSpace;
R.Width := PointWidth;
R.Height := PointWidth;
Expand Down

0 comments on commit 9bb0703

Please sign in to comment.