From 544ce8649570f1e88cb35e2caf61aaeed693802e Mon Sep 17 00:00:00 2001 From: ask Date: Mon, 3 Sep 2012 13:03:58 +0000 Subject: [PATCH] TAChart: Split DataPointMode into DataPointModeStart and DataPointModeEnd git-svn-id: trunk@38498 - --- components/tachart/tadatatools.pas | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/components/tachart/tadatatools.pas b/components/tachart/tadatatools.pas index 113866eab5..1ac574542c 100644 --- a/components/tachart/tadatatools.pas +++ b/components/tachart/tadatatools.pas @@ -60,7 +60,8 @@ type strict private // Workaround for FPC 2.6 bug. Remove after migration to 2.8. FAnchors: array of TObject; - FDataPointMode: TDataPointMode; + FDataPointModeEnd: TDataPointMode; + FDataPointModeStart: TDataPointMode; FLastChart: TChart; FMarks: TDataPointDistanceToolMarks; FMeasureMode: TChartDistanceMode; @@ -80,7 +81,7 @@ type strict protected procedure DoDraw; override; function FindRef( - APoint: TPoint; ADest: TDataPointTool.TPointRef; + APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef; AOtherEndSeries: TBasicChartSeries): Boolean; function GetDistanceText: String; function SameTransformations(ASeries1, ASeries2: TBasicChartSeries): Boolean; @@ -103,8 +104,10 @@ type property GrabRadius default 20; property LinePen: TChartPen read FPen write SetPen; published - property DataPointMode: TDataPointMode - read FDataPointMode write FDataPointMode default dpmFree; + property DataPointModeEnd: TDataPointMode + read FDataPointModeEnd write FDataPointModeEnd default dpmFree; + property DataPointModeStart: TDataPointMode + read FDataPointModeStart write FDataPointModeStart default dpmFree; property Marks: TDataPointDistanceToolMarks read FMarks write SetMarks; property MeasureMode: TChartDistanceMode read FMeasureMode write FMeasureMode default cdmXY; @@ -258,11 +261,11 @@ begin end; function TDataPointDistanceTool.FindRef( - APoint: TPoint; ADest: TDataPointTool.TPointRef; + APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef; AOtherEndSeries: TBasicChartSeries): Boolean; begin FSeries := nil; - if DataPointMode in [dpmSnap, dpmLock] then begin + if AMode in [dpmSnap, dpmLock] then begin FindNearestPoint(APoint); ADest.FGraphPos := FNearestGraphPoint; ADest.FIndex := PointIndex; @@ -272,7 +275,7 @@ begin ADest.FSeries := FSeries; if FSeries = nil then ADest.SetGraphPos(FChart.ImageToGraph(APoint)); - Result := (FSeries <> nil) or (DataPointMode <> dpmLock); + Result := (FSeries <> nil) or (AMode <> dpmLock); end; // Use Marks.Format and/or OnGetDistanceText event handler to create the text @@ -311,7 +314,7 @@ begin if dpdoPermanent in Options then DoHide; PointStart.FSeries := nil; - if FindRef(APoint, PointStart, nil) then + if FindRef(APoint, DataPointModeStart, PointStart, nil) then Activate; PointEnd.Assign(PointStart); Handled; @@ -325,7 +328,7 @@ begin DoHide; newEnd := TPointRef.Create; try - if FindRef(APoint, newEnd, PointStart.Series) then + if FindRef(APoint, DataPointModeEnd, newEnd, PointStart.Series) then PointEnd.Assign(newEnd); finally FreeAndNil(newEnd);