mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-11 21:55:56 +02:00
TAChart: Add Hide and KeyDown methods to TDataPointCrosshairTool
git-svn-id: trunk@31971 -
This commit is contained in:
parent
ad3dfd2bae
commit
a9be6582cb
@ -382,6 +382,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure Draw(AChart: TChart; ADrawer: IChartDrawer); override;
|
procedure Draw(AChart: TChart; ADrawer: IChartDrawer); override;
|
||||||
|
procedure Hide;
|
||||||
|
procedure KeyDown(APoint: TPoint); override;
|
||||||
procedure MouseMove(APoint: TPoint); override;
|
procedure MouseMove(APoint: TPoint); override;
|
||||||
property Position: TDoublePoint read FPosition;
|
property Position: TDoublePoint read FPosition;
|
||||||
published
|
published
|
||||||
@ -1443,10 +1445,13 @@ begin
|
|||||||
FChart.DrawLineHoriz(FChart.Drawer, p.Y)
|
FChart.DrawLineHoriz(FChart.Drawer, p.Y)
|
||||||
else
|
else
|
||||||
FChart.Drawer.Line(p - Point(Size, 0), p + Point(Size, 0));
|
FChart.Drawer.Line(p - Point(Size, 0), p + Point(Size, 0));
|
||||||
|
if Assigned(OnDraw) then
|
||||||
|
OnDraw(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDataPointCrosshairTool.Draw(AChart: TChart; ADrawer: IChartDrawer);
|
procedure TDataPointCrosshairTool.Draw(AChart: TChart; ADrawer: IChartDrawer);
|
||||||
begin
|
begin
|
||||||
|
if FSeries = nil then exit;
|
||||||
inherited;
|
inherited;
|
||||||
case EffectiveDrawingMode of
|
case EffectiveDrawingMode of
|
||||||
tdmXor:
|
tdmXor:
|
||||||
@ -1457,21 +1462,34 @@ begin
|
|||||||
DoDraw;
|
DoDraw;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDataPointCrosshairTool.MouseMove(APoint: TPoint);
|
procedure TDataPointCrosshairTool.Hide;
|
||||||
begin
|
begin
|
||||||
FindNearestPoint(APoint);
|
|
||||||
if FSeries = nil then exit;
|
if FSeries = nil then exit;
|
||||||
|
FSeries := nil;
|
||||||
case EffectiveDrawingMode of
|
case EffectiveDrawingMode of
|
||||||
tdmXor: begin
|
tdmXor: begin
|
||||||
PrepareXorPen(FChart.Canvas);
|
PrepareXorPen(FChart.Canvas);
|
||||||
DoDraw;
|
DoDraw;
|
||||||
FPosition := FNearestGraphPoint;
|
|
||||||
DoDraw;
|
|
||||||
end;
|
end;
|
||||||
tdmNormal: begin
|
tdmNormal:
|
||||||
FPosition := FNearestGraphPoint;
|
|
||||||
FChart.StyleChanged(Self);
|
FChart.StyleChanged(Self);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDataPointCrosshairTool.KeyDown(APoint: TPoint);
|
||||||
|
begin
|
||||||
|
MouseMove(APoint);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDataPointCrosshairTool.MouseMove(APoint: TPoint);
|
||||||
|
begin
|
||||||
|
Hide;
|
||||||
|
FindNearestPoint(APoint);
|
||||||
|
if FSeries = nil then exit;
|
||||||
|
FPosition := FNearestGraphPoint;
|
||||||
|
if EffectiveDrawingMode = tdmXor then begin
|
||||||
|
PrepareXorPen(FChart.Canvas);
|
||||||
|
DoDraw;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user