mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-23 18:49:30 +02:00
lcl: don't call GetCursorPos() twice while initializing Drag/Dock operation. Use the first time retrieved value.
git-svn-id: trunk@42626 -
This commit is contained in:
parent
9178ca6047
commit
0032f227a7
@ -98,6 +98,8 @@ type
|
||||
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer); override;
|
||||
procedure DragMove(APosition: TPoint); override;
|
||||
procedure DragStop(ADropped: Boolean); override;
|
||||
|
||||
property StartPosition: TPoint read FStartPosition;
|
||||
end;
|
||||
|
||||
|
||||
@ -129,17 +131,13 @@ end;
|
||||
|
||||
constructor TDragPerformer.Create(AManager: TDragManagerDefault; AControl: TControl);
|
||||
//Start a drag operation, if not already running
|
||||
var
|
||||
p: TPoint;
|
||||
begin
|
||||
inherited Create(AManager, AControl);
|
||||
|
||||
AControl.DoStartDrag(FDragObject);
|
||||
if FDragObject = nil then
|
||||
FDragObject := TDragControlObject.AutoCreate(AControl);
|
||||
|
||||
GetCursorPos(p);
|
||||
FDragObject.DragPos := p;
|
||||
FDragObject.DragPos := AManager.StartPosition;
|
||||
SetCaptureControl(AControl);
|
||||
end;
|
||||
|
||||
@ -270,16 +268,13 @@ end;
|
||||
|
||||
constructor TDockPerformer.Create(AManager: TDragManagerDefault; AControl: TControl);
|
||||
//Start a drag operation, if not already running
|
||||
var
|
||||
APoint: TPoint;
|
||||
begin
|
||||
inherited Create(AManager, AControl);
|
||||
AControl.DoStartDock(TDragObject(FDockObject));
|
||||
if FDockObject = nil then
|
||||
FDockObject := TDragDockObject.AutoCreate(AControl);
|
||||
|
||||
GetCursorPos(APoint);
|
||||
FDockObject.InitDock(APoint);
|
||||
FDockObject.InitDock(AManager.StartPosition);
|
||||
// we are tracking capture change to stop drag/dock is happen
|
||||
SetCaptureControl(AControl);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user