From 643da08e7a705a61a480feee03ae161b5785f6a7 Mon Sep 17 00:00:00 2001 From: wp Date: Thu, 4 Apr 2019 18:00:13 +0000 Subject: [PATCH] TAChart: Make TAxisClickTool respond to click on axis grid. git-svn-id: trunk@60834 - --- components/tachart/tachartaxis.pas | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/components/tachart/tachartaxis.pas b/components/tachart/tachartaxis.pas index 187c206f86..37423c8b90 100644 --- a/components/tachart/tachartaxis.pas +++ b/components/tachart/tachartaxis.pas @@ -81,7 +81,7 @@ type { TChartAxis } - TChartAxisHitTest = (ahtTitle, ahtLine, ahtLabels, + TChartAxisHitTest = (ahtTitle, ahtLine, ahtLabels, ahtGrid, ahtAxisStart, ahtAxisCenter, ahtAxisEnd); TChartAxisHitTests = set of TChartAxisHitTest; @@ -470,6 +470,7 @@ var R: TRect; w, h, loc: Integer; p: Integer; + t: TChartValueText; begin Result := []; if IsPointInPolygon(APoint, FTitlePolygon) then @@ -501,7 +502,24 @@ begin if IsPointInRect(APoint, R) then Include(Result, ahtLine) else if IsPointInside(APoint) then - Include(Result, ahtLabels); + Include(Result, ahtLabels) + else begin + R := FHelper.FClipRect^; + for t in FMarkValues do begin + p := FHelper.GraphToImage(FHelper.FAxisTransf(t.FValue)); + if IsVertical then begin + R.Top := p - ADelta; + R.Bottom := p + ADelta; + end else begin + R.Left := p - ADelta; + R.Right := p + ADelta; + end; + if IsPointInRect(APoint, R) then begin + Include(Result, ahtGrid); + break; + end; + end; + end; if Result = [] then exit;