Zoom behavior in TSimpleGraph

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Postby Kambiz » March 23rd, 2006, 10:07 pm

Here are methods that can manage each case:
  1. ChangeZoomBy(ADelta, zoCursor);
  2. ScrollCenter(CursorPos); ChangeZoomBy(ADelta, zoCenter);
  3. ZoomGraph;
  4. ZoomRect(ARect);
  5. ChangeZoom(100, zoTopLeft);
elias's idea is somehow combination of zoCursor and zoCenter. The point under cursor should move toward center.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby Kambiz » March 23rd, 2006, 10:11 pm

By the way, I'll add a zoCursorCenter option for the second case.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby kokkoras » March 23rd, 2006, 10:35 pm

Kambiz wrote:elias's idea is somehow combination of zoCursor and zoCenter.

Yes indeed. That's why I said that we can do whatever zoom we like.
Kambiz wrote:The point under cursor should move toward center.
I think he wants it a bit fancy and animated like. As soon as initial and final states are known, he can throw in a few intermediate steps.


Thank you Kambiz :wink:
Fotis
User avatar
kokkoras
Moderator
Moderator
 
Posts: 317
Joined: March 12th, 2005, 11:19 pm
Location: Thessaloniki, Greece

Postby Kambiz » March 23rd, 2006, 10:50 pm

Animated zoom is possible. For example, the new SGDemo has the following code for Mouse Wheel handlers.

Code: Select all
procedure TMainForm.SimpleGraphMouseWheelDown(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
var
  I: Integer;
begin
  MousePos := SimpleGraph.ScreenToClient(MousePos);
  if PtInRect(SimpleGraph.ClientRect, MousePos) then
  begin
    for I := 1 to 5 do
    begin
      SimpleGraph.ChangeZoomBy(-1, zoCursor);
      SimpleGraph.Update;
    end;
    Handled := True;
  end;
end;

procedure TMainForm.SimpleGraphMouseWheelUp(Sender: TObject;
  Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
var
  I: Integer;
begin
  MousePos := SimpleGraph.ScreenToClient(MousePos);
  if PtInRect(SimpleGraph.ClientRect, MousePos) then
  begin
    for I := 1 to 5 do
    begin
      SimpleGraph.ChangeZoomBy(+1, zoCursor);
      SimpleGraph.Update;
    end;
    Handled := True;
  end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Postby elias » March 24th, 2006, 8:23 am

:) I think I see clear now the procedures I have to use. As soon as I can I'll send you a test for prooving. Found helpful your posts.
elias
Senior Member
Senior Member
 
Posts: 90
Joined: November 8th, 2005, 12:09 pm
Location: Galicia, Spain

Previous

Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 2 guests

cron