mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 03:19:32 +02:00
TAChart: Fix TPieSlice.FindContainingSlice for the case of skipped slices
git-svn-id: trunk@35640 -
This commit is contained in:
parent
ab96a7be35
commit
f7471ce97d
@ -292,21 +292,20 @@ function TCustomPieSeries.FindContainingSlice(const APoint: TPoint): Integer;
|
||||
var
|
||||
c: TPoint;
|
||||
pointAngle: Double;
|
||||
ps: TPieSlice;
|
||||
begin
|
||||
if IsEmpty then exit(-1);
|
||||
|
||||
for Result := 0 to Count - 1 do
|
||||
with FSlices[Result] do begin
|
||||
c := APoint - FBase;
|
||||
pointAngle := ArcTan2(-c.Y, c.X);
|
||||
if pointAngle < 0 then
|
||||
pointAngle += 2 * Pi;
|
||||
if
|
||||
InRange(pointAngle, FPrevAngle, FNextAngle) and
|
||||
(Sqr(c.X) + Sqr(c.Y) <= Sqr(FRadius))
|
||||
then
|
||||
exit;
|
||||
end;
|
||||
for ps in FSlices do begin
|
||||
if not ps.FVisible then continue;
|
||||
c := APoint - ps.FBase;
|
||||
pointAngle := ArcTan2(-c.Y, c.X);
|
||||
if pointAngle < 0 then
|
||||
pointAngle += 2 * Pi;
|
||||
if
|
||||
InRange(pointAngle, ps.FPrevAngle, ps.FNextAngle) and
|
||||
(Sqr(c.X) + Sqr(c.Y) <= Sqr(FRadius))
|
||||
then
|
||||
exit(ps.FOrigIndex);
|
||||
end;
|
||||
Result := -1;
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user