mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 17:29:40 +02:00
TAChart: Fix DataPointClick tool for PieSeries.
git-svn-id: trunk@58457 -
This commit is contained in:
parent
a20966155d
commit
a955f927fa
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user