mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-18 23:09:33 +02:00
TAChart: Avoid chart popup menu opening at the end of a pan-drag operation with right mouse button.
git-svn-id: trunk@52391 -
This commit is contained in:
parent
8999b027ad
commit
c51bc87bab
@ -101,9 +101,11 @@ type
|
||||
TBasicChartTool = class(TIndexedComponent)
|
||||
strict protected
|
||||
FChart: TChart;
|
||||
FStartMousePos: TPoint;
|
||||
|
||||
procedure Activate; virtual;
|
||||
procedure Deactivate; virtual;
|
||||
function PopupMenuConflict: Boolean; virtual;
|
||||
public
|
||||
property Chart: TChart read FChart;
|
||||
end;
|
||||
@ -268,6 +270,8 @@ type
|
||||
procedure VisitSources(
|
||||
AVisitor: TChartOnSourceVisitor; AAxis: TChartAxis; var AData);
|
||||
protected
|
||||
FDisablePopupMenu: Boolean;
|
||||
procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override;
|
||||
function DoMouseWheel(
|
||||
AShift: TShiftState; AWheelDelta: Integer;
|
||||
AMousePos: TPoint): Boolean; override;
|
||||
@ -794,6 +798,12 @@ begin
|
||||
AxisList.Draw(MaxInt, axisIndex);
|
||||
end;
|
||||
|
||||
procedure TChart.DoContextPopup(MousePos: TPoint; var Handled: Boolean);
|
||||
begin
|
||||
if FDisablePopupMenu then Handled := true;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TChart.DoMouseWheel(
|
||||
AShift: TShiftState; AWheelDelta: Integer; AMousePos: TPoint): Boolean;
|
||||
const
|
||||
@ -1874,12 +1884,21 @@ procedure TBasicChartTool.Activate;
|
||||
begin
|
||||
FChart.FActiveToolIndex := Index;
|
||||
FChart.MouseCapture := true;
|
||||
FChart.FDisablePopupMenu := false;
|
||||
FStartMousePos := Mouse.CursorPos;
|
||||
end;
|
||||
|
||||
procedure TBasicChartTool.Deactivate;
|
||||
begin
|
||||
FChart.MouseCapture := false;
|
||||
FChart.FActiveToolIndex := -1;
|
||||
if PopupMenuConflict then
|
||||
FChart.FDisablePopupMenu := true;
|
||||
end;
|
||||
|
||||
function TBasicChartTool.PopupMenuConflict: Boolean;
|
||||
begin
|
||||
Result := false;
|
||||
end;
|
||||
|
||||
procedure SkipObsoleteChartProperties;
|
||||
|
@ -69,6 +69,7 @@ type
|
||||
procedure MouseUp(APoint: TPoint); virtual;
|
||||
procedure MouseWheelDown(APoint: TPoint); virtual;
|
||||
procedure MouseWheelUp(APoint: TPoint); virtual;
|
||||
function PopupMenuConflict: Boolean; override;
|
||||
procedure PrepareDrawingModePen(ADrawer: IChartDrawer; APen: TFPCustomPen);
|
||||
procedure RestoreCursor;
|
||||
procedure SetCursor;
|
||||
@ -838,6 +839,21 @@ begin
|
||||
Unused(APoint);
|
||||
end;
|
||||
|
||||
function TChartTool.PopupMenuConflict: Boolean;
|
||||
var
|
||||
P: TPoint;
|
||||
begin
|
||||
Result := false;
|
||||
if Shift = [ssRight] then begin
|
||||
P := Mouse.CursorPos;
|
||||
if (P.X = FStartMousePos.X) then
|
||||
exit;
|
||||
if (P.Y = FStartMousePos.Y) then
|
||||
exit;
|
||||
Result := true;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChartTool.PrepareDrawingModePen(
|
||||
ADrawer: IChartDrawer; APen: TFPCustomPen);
|
||||
begin
|
||||
|
Loading…
Reference in New Issue
Block a user