diff --git a/components/tachart/tacustomseries.pas b/components/tachart/tacustomseries.pas index 791305bdaf..37eda427b0 100644 --- a/components/tachart/tacustomseries.pas +++ b/components/tachart/tacustomseries.pas @@ -262,7 +262,7 @@ type function GetNearestPoint( const AParams: TNearestPointParams; out AResults: TNearestPointResults): Boolean; override; - procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); override; + procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); override; property MarkPositions: TLinearMarkPositions read FMarkPositions write SetMarkPositions default lmpOutside; property UseReticule: Boolean @@ -1055,15 +1055,12 @@ begin end; procedure TBasicPointSeries.MovePoint( - var AIndex: Integer; const ANewPos: TPoint); -var - p: TDoublePoint; + var AIndex: Integer; const ANewPos: TDoublePoint); begin if not InRange(AIndex, 0, Count - 1) then exit; - p := FChart.ImageToGraph(ANewPos); with ListSource do begin - AIndex := SetXValue(AIndex, p.X); - SetYValue(AIndex, p.Y); + AIndex := SetXValue(AIndex, ANewPos.X); + SetYValue(AIndex, ANewPos.Y); end; end; diff --git a/components/tachart/tagraph.pas b/components/tachart/tagraph.pas index 35a6d64da7..bcce60c11b 100644 --- a/components/tachart/tagraph.pas +++ b/components/tachart/tagraph.pas @@ -81,7 +81,8 @@ type procedure Draw(ADrawer: IChartDrawer); virtual; abstract; function GetGraphBounds: TDoubleRect; virtual; abstract; function IsEmpty: Boolean; virtual; abstract; - procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); virtual; + procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); overload; inline; + procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); overload; virtual; property Active: Boolean read FActive write SetActive default true; property Depth: TChartDistance read FDepth write SetDepth default 0; @@ -1581,11 +1582,17 @@ begin end; procedure TBasicChartSeries.MovePoint( - var AIndex: Integer; const ANewPos: TPoint); + var AIndex: Integer; const ANewPos: TDoublePoint); begin Unused(AIndex, ANewPos) end; +procedure TBasicChartSeries.MovePoint( + var AIndex: Integer; const ANewPos: TPoint); +begin + MovePoint(AIndex, FChart.ImageToGraph(ANewPos)); +end; + procedure TBasicChartSeries.UpdateMargins( ADrawer: IChartDrawer; var AMargins: TRect); begin diff --git a/components/tachart/taseries.pas b/components/tachart/taseries.pas index 514049a146..941141bfa4 100644 --- a/components/tachart/taseries.pas +++ b/components/tachart/taseries.pas @@ -269,7 +269,7 @@ type function GetNearestPoint( const AParams: TNearestPointParams; out AResults: TNearestPointResults): Boolean; override; - procedure MovePoint(var AIndex: Integer; const ANewPos: TPoint); override; + procedure MovePoint(var AIndex: Integer; const ANewPos: TDoublePoint); override; published property Active default true; @@ -710,21 +710,17 @@ begin Result := FPen.Color; end; -procedure TConstantLine.MovePoint(var AIndex: Integer; const ANewPos: TPoint); +procedure TConstantLine.MovePoint( + var AIndex: Integer; const ANewPos: TDoublePoint); begin Unused(AIndex); - if LineStyle = lsVertical then - Position := GraphToAxisX(FChart.XImageToGraph(ANewPos.X)) - else - Position := GraphToAxisX(FChart.YImageToGraph(ANewPos.Y)); + Position := + GraphToAxisX(TDoublePointBoolArr(ANewPos)[LineStyle = lsHorizontal]); end; procedure TConstantLine.SavePosToCoord(var APoint: TDoublePoint); begin - if LineStyle = lsVertical then - APoint.X := Position - else - APoint.Y := Position; + TDoublePointBoolArr(APoint)[LineStyle = lsHorizontal] := Position; end; procedure TConstantLine.SetArrow(AValue: TChartArrow);