TAChart: Fix DataPointClick tool for PieSeries.

git-svn-id: trunk@58457 -
This commit is contained in:
wp 2018-07-07 11:31:37 +00:00
parent a20966155d
commit a955f927fa
3 changed files with 11 additions and 2 deletions

View File

@ -51,6 +51,7 @@ type
FShadow: TChartShadow;
FTransparency: TChartTransparency;
FZPosition: TChartDistance;
FSpecialPointPos: Boolean;
procedure AfterAdd; virtual; abstract;
procedure AfterDraw; virtual;
@ -93,6 +94,7 @@ type
property DragOrigin: TPoint read FDragOrigin write FDragOrigin;
property ParentChart: TChart read FChart;
property Shadow: TChartShadow read FShadow write SetShadow;
property SpecialPointPos: Boolean read FSpecialPointPos;
property Transparency: TChartTransparency
read FTransparency write SetTransparency default 0;
property ZPosition: TChartDistance read FZPosition write SetZPosition default 0;

View File

@ -246,6 +246,9 @@ begin
inherited Create(AOwner);
FEdgePen := TPen.Create;
FEdgePen.OnChange := @StyleChanged;
// Tell DataPointTool that data points are not at their regular x/y coordinates
FSpecialPointPos := True;
end;
destructor TCustomPieSeries.Destroy;

View File

@ -1643,9 +1643,13 @@ procedure TDataPointTool.FindNearestPoint(APoint: TPoint);
p: TDoublePoint;
ext: TDoubleRect;
begin
if ASeries.SpecialPointPos then
exit(true);
r := ASeries.GetGraphBounds;
ext := FChart.CurrentExtent;
if not RectIntersectsRect(r, ext) then exit(false);
if not RectIntersectsRect(r, ext) then
exit(false);
if FMouseInsideOnly then begin
p := FChart.ImageToGraph(APoint);
@ -1795,7 +1799,7 @@ procedure TDataPointClickTool.MouseUp(APoint: TPoint);
begin
if
Assigned(OnPointClick) and (FSeries <> nil) and
(PointDist(APoint, FMouseDownPoint) <= Sqr(GrabRadius))
(FSeries.SpecialPointPos or (PointDist(APoint, FMouseDownPoint) <= Sqr(GrabRadius)))
then
OnPointClick(Self, FMouseDownPoint);
FSeries := nil;