mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 23:35:57 +02:00
TAChart: Block all extent notifications in mini-map mode
git-svn-id: trunk@29940 -
This commit is contained in:
parent
42d6eb9431
commit
dcc462fe9b
@ -153,12 +153,16 @@ type
|
||||
{ TBroadcaster }
|
||||
|
||||
TBroadcaster = class(TFPList)
|
||||
private
|
||||
FLocked: Boolean;
|
||||
public
|
||||
destructor Destroy; override;
|
||||
public
|
||||
procedure Broadcast(ASender: TObject);
|
||||
procedure Subscribe(AListener: TListener);
|
||||
procedure Unsubscribe(AListener: TListener);
|
||||
public
|
||||
property Locked: Boolean read FLocked write FLocked;
|
||||
end;
|
||||
|
||||
{ TDrawDataItem }
|
||||
@ -712,6 +716,7 @@ procedure TBroadcaster.Broadcast(ASender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Locked then exit;
|
||||
for i := 0 to Count - 1 do
|
||||
TListener(Items[i]).Notify(ASender);
|
||||
end;
|
||||
|
@ -978,6 +978,7 @@ begin
|
||||
oldLogicalExtent := FLogicalExtent;
|
||||
oldPrevLogicalExtent := FPrevLogicalExtent;
|
||||
oldIsZoomed := FIsZoomed;
|
||||
ExtentBroadcaster.Locked := true;
|
||||
try
|
||||
FIsZoomed := false;
|
||||
PaintOnCanvas(ACanvas, ARect);
|
||||
@ -988,6 +989,7 @@ begin
|
||||
FLogicalExtent := oldLogicalExtent;
|
||||
FPrevLogicalExtent := oldPrevLogicalExtent;
|
||||
FIsZoomed := oldIsZoomed;
|
||||
ExtentBroadcaster.Locked := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -95,7 +95,6 @@ type
|
||||
FOldCursor: TCursor;
|
||||
FPrevPoint: TDoublePoint;
|
||||
FScale: TDoublePoint;
|
||||
FUpdateLocked: Boolean;
|
||||
procedure ChartExtentChanged(ASender: TObject);
|
||||
private
|
||||
FAllowDragNavigation: Boolean;
|
||||
@ -248,8 +247,7 @@ end;
|
||||
procedure TChartNavPanel.ChartExtentChanged(ASender: TObject);
|
||||
begin
|
||||
Unused(ASender);
|
||||
if not FUpdateLocked then
|
||||
Invalidate;
|
||||
Invalidate;
|
||||
end;
|
||||
|
||||
constructor TChartNavPanel.Create(AOwner: TComponent);
|
||||
@ -321,7 +319,7 @@ end;
|
||||
|
||||
procedure TChartNavPanel.Paint;
|
||||
|
||||
function DrawRect(ARect: TDoubleRect): TRect;
|
||||
function GraphRect(ARect: TDoubleRect): TRect;
|
||||
begin
|
||||
with ARect do begin
|
||||
a := a * FScale + FOffset;
|
||||
@ -329,13 +327,13 @@ procedure TChartNavPanel.Paint;
|
||||
Result := Rect(
|
||||
Round(a.X), Height - Round(a.Y), Round(b.X), Height - Round(b.Y));
|
||||
end;
|
||||
Canvas.Rectangle(Result);
|
||||
end;
|
||||
|
||||
var
|
||||
fe, le, ext: TDoubleRect;
|
||||
sz: TDoublePoint;
|
||||
oldAxisVisible: Boolean;
|
||||
feRect: TRect;
|
||||
begin
|
||||
if Chart = nil then exit;
|
||||
fe := Chart.GetFullExtent;
|
||||
@ -359,16 +357,12 @@ begin
|
||||
end;
|
||||
FOffset -= ext.a * FScale;
|
||||
|
||||
feRect := GraphRect(fe);
|
||||
if MiniMap then begin
|
||||
FUpdateLocked := true;
|
||||
oldAxisVisible := Chart.AxisVisible;
|
||||
Chart.AxisVisible := false;
|
||||
try
|
||||
Chart.PaintOnAuxCanvas(Canvas, Rect(0, 0, Width, Height));
|
||||
Chart.AxisVisible := oldAxisVisible;
|
||||
finally
|
||||
FUpdateLocked := false;
|
||||
end;
|
||||
Chart.PaintOnAuxCanvas(Canvas, feRect);
|
||||
Chart.AxisVisible := oldAxisVisible;
|
||||
end
|
||||
else begin
|
||||
Canvas.Brush.Color := Chart.BackColor;
|
||||
@ -377,9 +371,10 @@ begin
|
||||
end;
|
||||
Canvas.Brush.Style := bsClear;
|
||||
Canvas.Pen := FullExtentPen;
|
||||
DrawRect(fe);
|
||||
Canvas.Rectangle(feRect);
|
||||
Canvas.Pen := LogicalExtentPen;
|
||||
FLogicalExtentRect := DrawRect(le);
|
||||
FLogicalExtentRect := GraphRect(le);
|
||||
Canvas.Rectangle(FLogicalExtentRect);
|
||||
end;
|
||||
|
||||
procedure TChartNavPanel.SetChart(AValue: TChart);
|
||||
|
Loading…
Reference in New Issue
Block a user