mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-21 10:59:36 +02:00
TAChart: Split DataPointMode into DataPointModeStart and DataPointModeEnd
git-svn-id: trunk@38498 -
This commit is contained in:
parent
528433b671
commit
544ce86495
@ -60,7 +60,8 @@ type
|
|||||||
strict private
|
strict private
|
||||||
// Workaround for FPC 2.6 bug. Remove after migration to 2.8.
|
// Workaround for FPC 2.6 bug. Remove after migration to 2.8.
|
||||||
FAnchors: array of TObject;
|
FAnchors: array of TObject;
|
||||||
FDataPointMode: TDataPointMode;
|
FDataPointModeEnd: TDataPointMode;
|
||||||
|
FDataPointModeStart: TDataPointMode;
|
||||||
FLastChart: TChart;
|
FLastChart: TChart;
|
||||||
FMarks: TDataPointDistanceToolMarks;
|
FMarks: TDataPointDistanceToolMarks;
|
||||||
FMeasureMode: TChartDistanceMode;
|
FMeasureMode: TChartDistanceMode;
|
||||||
@ -80,7 +81,7 @@ type
|
|||||||
strict protected
|
strict protected
|
||||||
procedure DoDraw; override;
|
procedure DoDraw; override;
|
||||||
function FindRef(
|
function FindRef(
|
||||||
APoint: TPoint; ADest: TDataPointTool.TPointRef;
|
APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef;
|
||||||
AOtherEndSeries: TBasicChartSeries): Boolean;
|
AOtherEndSeries: TBasicChartSeries): Boolean;
|
||||||
function GetDistanceText: String;
|
function GetDistanceText: String;
|
||||||
function SameTransformations(ASeries1, ASeries2: TBasicChartSeries): Boolean;
|
function SameTransformations(ASeries1, ASeries2: TBasicChartSeries): Boolean;
|
||||||
@ -103,8 +104,10 @@ type
|
|||||||
property GrabRadius default 20;
|
property GrabRadius default 20;
|
||||||
property LinePen: TChartPen read FPen write SetPen;
|
property LinePen: TChartPen read FPen write SetPen;
|
||||||
published
|
published
|
||||||
property DataPointMode: TDataPointMode
|
property DataPointModeEnd: TDataPointMode
|
||||||
read FDataPointMode write FDataPointMode default dpmFree;
|
read FDataPointModeEnd write FDataPointModeEnd default dpmFree;
|
||||||
|
property DataPointModeStart: TDataPointMode
|
||||||
|
read FDataPointModeStart write FDataPointModeStart default dpmFree;
|
||||||
property Marks: TDataPointDistanceToolMarks read FMarks write SetMarks;
|
property Marks: TDataPointDistanceToolMarks read FMarks write SetMarks;
|
||||||
property MeasureMode: TChartDistanceMode
|
property MeasureMode: TChartDistanceMode
|
||||||
read FMeasureMode write FMeasureMode default cdmXY;
|
read FMeasureMode write FMeasureMode default cdmXY;
|
||||||
@ -258,11 +261,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataPointDistanceTool.FindRef(
|
function TDataPointDistanceTool.FindRef(
|
||||||
APoint: TPoint; ADest: TDataPointTool.TPointRef;
|
APoint: TPoint; AMode: TDataPointMode; ADest: TDataPointTool.TPointRef;
|
||||||
AOtherEndSeries: TBasicChartSeries): Boolean;
|
AOtherEndSeries: TBasicChartSeries): Boolean;
|
||||||
begin
|
begin
|
||||||
FSeries := nil;
|
FSeries := nil;
|
||||||
if DataPointMode in [dpmSnap, dpmLock] then begin
|
if AMode in [dpmSnap, dpmLock] then begin
|
||||||
FindNearestPoint(APoint);
|
FindNearestPoint(APoint);
|
||||||
ADest.FGraphPos := FNearestGraphPoint;
|
ADest.FGraphPos := FNearestGraphPoint;
|
||||||
ADest.FIndex := PointIndex;
|
ADest.FIndex := PointIndex;
|
||||||
@ -272,7 +275,7 @@ begin
|
|||||||
ADest.FSeries := FSeries;
|
ADest.FSeries := FSeries;
|
||||||
if FSeries = nil then
|
if FSeries = nil then
|
||||||
ADest.SetGraphPos(FChart.ImageToGraph(APoint));
|
ADest.SetGraphPos(FChart.ImageToGraph(APoint));
|
||||||
Result := (FSeries <> nil) or (DataPointMode <> dpmLock);
|
Result := (FSeries <> nil) or (AMode <> dpmLock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Use Marks.Format and/or OnGetDistanceText event handler to create the text
|
// Use Marks.Format and/or OnGetDistanceText event handler to create the text
|
||||||
@ -311,7 +314,7 @@ begin
|
|||||||
if dpdoPermanent in Options then
|
if dpdoPermanent in Options then
|
||||||
DoHide;
|
DoHide;
|
||||||
PointStart.FSeries := nil;
|
PointStart.FSeries := nil;
|
||||||
if FindRef(APoint, PointStart, nil) then
|
if FindRef(APoint, DataPointModeStart, PointStart, nil) then
|
||||||
Activate;
|
Activate;
|
||||||
PointEnd.Assign(PointStart);
|
PointEnd.Assign(PointStart);
|
||||||
Handled;
|
Handled;
|
||||||
@ -325,7 +328,7 @@ begin
|
|||||||
DoHide;
|
DoHide;
|
||||||
newEnd := TPointRef.Create;
|
newEnd := TPointRef.Create;
|
||||||
try
|
try
|
||||||
if FindRef(APoint, newEnd, PointStart.Series) then
|
if FindRef(APoint, DataPointModeEnd, newEnd, PointStart.Series) then
|
||||||
PointEnd.Assign(newEnd);
|
PointEnd.Assign(newEnd);
|
||||||
finally
|
finally
|
||||||
FreeAndNil(newEnd);
|
FreeAndNil(newEnd);
|
||||||
|
Loading…
Reference in New Issue
Block a user