forked from Mirrors/openclonk
Only send MouseSelection callback when the object was hovered at button press time
parent
8d2c6ca599
commit
e041b790d8
|
@ -745,27 +745,33 @@ void C4MouseControl::DragSelect()
|
||||||
|
|
||||||
void C4MouseControl::LeftUp()
|
void C4MouseControl::LeftUp()
|
||||||
{
|
{
|
||||||
|
// Ignore left up after double click
|
||||||
|
if (LeftDoubleIgnoreUp)
|
||||||
|
{
|
||||||
|
LeftDoubleIgnoreUp=false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Evaluate by drag status
|
||||||
|
switch (Drag)
|
||||||
|
{
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
case C4MC_Drag_Unhandled: // nobreak
|
||||||
|
case C4MC_Drag_None: LeftUpDragNone(); break;
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
case C4MC_Drag_Selecting: ButtonUpDragSelecting(); break;
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
case C4MC_Drag_Moving: ButtonUpDragMoving(); break;
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
case C4MC_Drag_Construct: ButtonUpDragConstruct(); break;
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
}
|
||||||
|
}
|
||||||
// Update status flag
|
// Update status flag
|
||||||
LeftButtonDown=false;
|
LeftButtonDown=false;
|
||||||
if(!RightButtonDown) DownTarget = NULL;
|
if(!RightButtonDown) DownTarget = NULL;
|
||||||
// Ignore left up after double click
|
|
||||||
if (LeftDoubleIgnoreUp) { LeftDoubleIgnoreUp=false; return; }
|
|
||||||
// Evaluate by drag status
|
|
||||||
switch (Drag)
|
|
||||||
{
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
case C4MC_Drag_Unhandled: // nobreak
|
|
||||||
case C4MC_Drag_None: LeftUpDragNone(); break;
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
case C4MC_Drag_Selecting: ButtonUpDragSelecting(); break;
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
case C4MC_Drag_Moving: ButtonUpDragMoving(); break;
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
case C4MC_Drag_Construct: ButtonUpDragConstruct(); break;
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4MouseControl::DragMoving()
|
void C4MouseControl::DragMoving()
|
||||||
|
@ -865,10 +871,6 @@ void C4MouseControl::RightDown()
|
||||||
|
|
||||||
void C4MouseControl::RightUp()
|
void C4MouseControl::RightUp()
|
||||||
{
|
{
|
||||||
// Update status flag
|
|
||||||
RightButtonDown=false;
|
|
||||||
if(!LeftButtonDown) DownTarget = NULL;
|
|
||||||
|
|
||||||
// Evaluate by drag status
|
// Evaluate by drag status
|
||||||
switch (Drag)
|
switch (Drag)
|
||||||
{
|
{
|
||||||
|
@ -885,6 +887,9 @@ void C4MouseControl::RightUp()
|
||||||
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
case C4MC_Drag_Script: ButtonUpDragScript(); break;
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
}
|
}
|
||||||
|
// Update status flag
|
||||||
|
RightButtonDown=false;
|
||||||
|
if(!LeftButtonDown) DownTarget = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void C4MouseControl::Wheel(DWORD dwFlags)
|
void C4MouseControl::Wheel(DWORD dwFlags)
|
||||||
|
@ -984,7 +989,8 @@ void C4MouseControl::LeftUpDragNone()
|
||||||
// Selection
|
// Selection
|
||||||
case C4MC_Cursor_Select:
|
case C4MC_Cursor_Select:
|
||||||
// Object selection to control queue
|
// Object selection to control queue
|
||||||
if (!IsPassive()) Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,false));
|
if (!IsPassive() && Selection.GetObject() == DownTarget)
|
||||||
|
Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,false));
|
||||||
break;
|
break;
|
||||||
case C4MC_Cursor_Nothing:
|
case C4MC_Cursor_Nothing:
|
||||||
break;
|
break;
|
||||||
|
@ -1078,7 +1084,7 @@ void C4MouseControl::RightUpDragNone()
|
||||||
{ SendControl(DownRegion.RightCom); return; }
|
{ SendControl(DownRegion.RightCom); return; }
|
||||||
|
|
||||||
// Alternative object selection
|
// Alternative object selection
|
||||||
if (Cursor==C4MC_Cursor_Select && !IsPassive())
|
if (Cursor==C4MC_Cursor_Select && !IsPassive() && Selection.GetObject() == DownTarget)
|
||||||
{ Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,true)); }
|
{ Game.Input.Add(CID_PlrSelect, new C4ControlPlayerSelect(Player,Selection,true)); }
|
||||||
|
|
||||||
// TODO: Evaluate right click
|
// TODO: Evaluate right click
|
||||||
|
|
Loading…
Reference in New Issue