Recent

Author Topic: tachart/tutorials/mandelbrot  (Read 323 times)

kiyo

  • New Member
  • *
  • Posts: 10
tachart/tutorials/mandelbrot
« on: June 02, 2025, 04:45:55 am »
I am using Windows version .
have compiled the following project:
C:/lazarus/components/tachart/tutorials/mandelbrot
however
Zoom with mouse left-drag does not work.
Please let me know the cause and solution.



wp

  • Hero Member
  • *****
  • Posts: 12866
Re: tachart/tutorials/mandelbrot
« Reply #1 on: June 02, 2025, 09:59:26 am »
Thanks for reporting. It seems that something broke it between v2.2.6 and v3.0.0...

[EDIT]
Found it - it was caused by some optimization more than two years ago. Is fixed in Laz/main and /fixes (i.e. will be included in v.4.2). If you want to fix your current version open file tagraph.pas from folder components/tachart of your Lazarus installation. Find the implementation of TChart.SetLogicalExtent. Insert "FOldClipRect := ZeroRect" before the line "FLogicalExtent := AValue"

Code: Pascal  [Select][+][-]
  1. procedure TChart.SetLogicalExtent(AValue: TDoubleRect);
  2. var
  3.   AllowChange: Boolean;
  4.   w, h: Double;
  5. begin
  6.   [...]
  7.   if FLogicalExtent = AValue then exit;
  8.   w := Abs(AValue.a.X - AValue.b.X);
  9.   h := Abs(AValue.a.Y - AValue.b.Y);
  10.   with ExtentSizeLimit do
  11.     if
  12.       UseXMin and (w < XMin) or UseXMax and (w > XMax) or
  13.       UseYMin and (h < YMin) or UseYMax and (h > YMax)
  14.     then
  15.       exit;
  16.   FOldClipRect := ZeroRect;
  17.   FLogicalExtent := AValue;
  18.   FIsZoomed := true;
  19.   StyleChanged(Self);
  20. end;

Then do the same in TChart.ZoomFull:
Code: Pascal  [Select][+][-]
  1. procedure TChart.ZoomFull(AImmediateRecalc: Boolean);
  2. begin
  3.   if AImmediateRecalc then
  4.     FLogicalExtent := GetFullExtent;
  5.   if not FIsZoomed then exit;
  6.   FIsZoomed := false;
  7.   FOldClipRect := ZeroRect;
  8.   Invalidate;
  9. end;  
« Last Edit: June 02, 2025, 11:07:44 am by wp »

kiyo

  • New Member
  • *
  • Posts: 10
Re: tachart/tutorials/mandelbrot
« Reply #2 on: June 03, 2025, 12:05:40 pm »
Thank you for your prompt response
I confirmed that the issue has been resolved in Lazarus 4.0.

 

TinyPortal © 2005-2018