Changeset 33 for trunk/UProject.pas
- Timestamp:
- Jan 5, 2017, 11:48:36 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UProject.pas
r26 r33 9 9 10 10 type 11 12 { TFloatPoint } 13 14 TFloatPoint = record 15 X, Y: Double; 16 function Create(AX, AY: Double): TFloatPoint; 17 end; 11 18 12 19 { TView } … … 23 30 procedure Center(Rect: TRect); 24 31 constructor Create; 32 procedure ZoomAll(BitmapSize: TPoint); 25 33 function DestToSrcPos(Pos: TPoint): TPoint; 26 34 function SrcToDestPos(Pos: TPoint): TPoint; … … 47 55 Result := (A.Left = B.Left) and (A.Top = B.Top) and 48 56 (A.Right = B.Right) and (A.Bottom = B.Bottom); 57 end; 58 59 { TFloatPoint } 60 61 function TFloatPoint.Create(AX, AY: Double): TFloatPoint; 62 begin 63 Result.X := AX; 64 Result.Y := AY; 49 65 end; 50 66 … … 102 118 end; 103 119 120 procedure TView.ZoomAll(BitmapSize: TPoint); 121 var 122 Factor: TFloatPoint; 123 begin 124 Factor := TFloatPoint.Create((DestRect.Right - DestRect.Left) / BitmapSize.X, 125 (DestRect.Bottom - DestRect.Top) / BitmapSize.Y); 126 if Factor.X < Factor.Y then Zoom := Factor.X 127 else Zoom := Factor.Y; 128 Center(Rect(0, 0, BitmapSize.X, BitmapSize.Y)); 129 end; 130 104 131 function TView.DestToSrcPos(Pos: TPoint): TPoint; 105 132 begin
Note:
See TracChangeset
for help on using the changeset viewer.