When starting to drag an object, use the object at mouse down time

and not at the time the drag is started, which is a bit later, after the mouse
has been moved a few pixels in order. This makes it easier to start dragging
when hitting the drag object on an edge.
rope
Armin Burgmeier 2012-02-25 22:05:47 +01:00
parent 7f5b7bcdd6
commit 09e0e48290
1 changed files with 7 additions and 5 deletions

View File

@ -785,6 +785,7 @@ void C4MouseControl::LeftUp()
{
// Update status flag
LeftButtonDown=false;
if(!RightButtonDown) DownTarget = NULL;
// Ignore left up after double click
if (LeftDoubleIgnoreUp) { LeftDoubleIgnoreUp=false; return; }
// Evaluate by drag status
@ -857,21 +858,20 @@ void C4MouseControl::DragNone()
break;
}
// check if target object allows scripted dragging
if (fAllowDrag && TargetObject)
if (fAllowDrag && DownTarget)
{
C4Object *drag_image_obj; C4ID drag_image_id;
// Drag only if MD_SOURCE is set and drag image is present
if ( (TargetObject->GetPropertyInt(P_MouseDrag) & C4MC_MD_DragSource) &&
TargetObject->GetDragImage(&drag_image_obj, &drag_image_id))
//if (TargetObject->GetDragImage(&drag_image_obj, &drag_image_id))
if ( (DownTarget->GetPropertyInt(P_MouseDrag) & C4MC_MD_DragSource) &&
DownTarget->GetDragImage(&drag_image_obj, &drag_image_id))
{
Drag=C4MC_Drag_Script;
if(drag_image_obj) DragImageObject = drag_image_obj;
else DragImageDef = C4Id2Def(drag_image_id);
DragObject = TargetObject;
DragObject = DownTarget;
}
}
@ -921,6 +921,8 @@ void C4MouseControl::RightUp()
{
// Update status flag
RightButtonDown=false;
if(!LeftButtonDown) DownTarget = NULL;
// Evaluate by drag status
switch (Drag)
{