Page 1 of 1

TTree zoom-behavior changed - how to get back the old one?

Posted: Tue May 19, 2009 11:47 am
by 10551336
Hello,

we upgraded simultaneously from TChart 7 to TChart 8 and from an older Delphi to Delphi 2009. We use the TTree rather extensively and also need the zoom functionality quite often. Now we discovered a change in behavior which is a problem for us.

OLD BEHAVIOR (the desired one):
When zooming in and out the center of the zoom is the center of the currently visible tree-area (client area of the component).

NEW BEHAVIOR:
When zooming in and out the center of the zoom is the center of the whole tree.

The new behavior has a big disadvantage: if you have a very large zoom factor to view small details and then use the mouse wheel to zoom out again it nearly always happens that the detail you just viewed kind of "runs away" to one of the edges of the component.

I think this is because while zooming in, the center of the tree is moved away from the center of the client area of the TTree component. When zooming out again, the center of the zoom operation is outside the client area thus making the content of the tree "heading" towards this spot.

I hope it is clear what I meant. If not, please say so and I'll try to clarify. This behavior is making zooming a real pain because to have one detail centered while zooming out you have to move it into the center of the client area again and again.

Thanks for reading, your time and hopefully help!

Markus-Heinrich

Posted: Mon May 25, 2009 8:02 am
by 10551336
Was there anything changed in the zoom behavior between the releases? Maybe there are new properties to adjust this behavior which I don't know about yet.

Any ideas are much appreciated!

Posted: Mon May 25, 2009 2:22 pm
by 10551336
Well I found the bug. It is in the following method:

Code: Select all

Procedure TView3DOptions.SetZoom(const Value:Double);
begin
  if FZoom<>Value then
  begin
    if Assigned(FOnChangedZoom) then FOnChangedZoom(Zoom); { <-- offending part! }

    FZoom:=Value;
    Repaint;
  end;
end;
The parameter given to the handler should not be Zoom, but Value - as it always was. It now would have to be rounded because of the type change, so the fix looks like this:

Code: Select all

    if Assigned(FOnChangedZoom) then FOnChangedZoom(round(Value));
Please, add this as fix to the next release, because otherwise the handling of our apps is considerably impaired!!

Thanks!

Posted: Mon May 25, 2009 3:25 pm
by yeray
Hi Markus-Heinrich,

Thank you for reporting this. I've implemented you suggestion so it will be available with next releases.