mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-15 05:39:17 +02:00
simplify docking code a bit
git-svn-id: trunk@14371 -
This commit is contained in:
parent
0e5e04980d
commit
bf42bc94f5
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user