Rotate and Pan

Problem The Rot3D component has a MouseAction called maRotAndZoom (this mode is a combination of maRotate and maZoom. The rotation is accomplished by pressing the left mouse button, the zooming is performed by using the right mouse button). I am really looking for property maRotAndPan, so I can rotate using my left mouse button and pan using the right mouse button.

Is there a way to accomplish this?

Applies To Release less than or equal to 8.5
Solution Unfortunately, there is no such option as "maRotAndPan". However, you can easily implement this by setting the MouseAction property to maRotate and add the following code to the OnMouseMove event handler:
procedure TForm1.Rot3D1MouseMove (Sender: TObject; Shift: TShiftState;
                                  X,Y: Integer);
begin
if ssRight in Shift then                       { pan by mouse move }
  begin
  if (X >= 0) and (X <= Width) and (Y >= 0) and (Y <= Height) then
    begin
    Rot3d1.CentX := X;
    Rot3d1.CentY := Y;
    end;
  end;
end;

 


Last Update: 2012-11-25