simplify docking code a bit

git-svn-id: trunk@14371 -
This commit is contained in:
paul 2008-03-03 03:17:02 +00:00
parent 0e5e04980d
commit bf42bc94f5
2 changed files with 4 additions and 22 deletions

View File

@ -201,11 +201,10 @@ begin
DropAlign, FDockRect);
end else
begin
FDockRect.TopLeft := Point(
DragPos.X - DragDockObject.DockOffset.x,
DragPos.Y - DragDockObject.DockOffset.y);
with FDockRect do
begin
Left := DragPos.X;
Top := DragPos.Y;
Right := Left + Control.UndockWidth;
Bottom := Top + Control.UndockHeight;
end;

View File

@ -74,24 +74,9 @@ end;
{ TDragDockObject }
procedure TDragDockObject.AdjustDockRect(ARect: TRect);
function AbsMin(Value1, Value2: Integer): Integer;
begin
if Abs(Value1) < Abs(Value2) then Result := Value1
else Result := Value2;
end;
var
DeltaX, DeltaY: Integer;
begin
if (ARect.Left > FDragPos.x) or (ARect.Right < FDragPos.x) then
DeltaX := AbsMin(ARect.Left - FDragPos.x, ARect.Right - FDragPos.x)
else DeltaX := 0;
if (ARect.Top > FDragPos.y) or (ARect.Bottom < FDragPos.y) then
DeltaY := AbsMin(ARect.Top - FDragPos.y, ARect.Bottom - FDragPos.y)
else DeltaY := 0;
if (DeltaX <> 0) or (DeltaY <> 0) then
OffsetRect(FDockRect, -DeltaX, -DeltaY);
with DockOffset do
OffsetRect(FDockRect, -X, -Y);
end;
function TDragDockObject.GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor;
@ -105,6 +90,4 @@ begin
FControl.DoEndDock(Target, X, Y);
end;
// included by controls.pp