Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -917,16 +917,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
ICoord2D pixel = msg->getArgument( 0 )->pixel;
UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer;

Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime);

if (isClick &&
cameraPos.length() > TheMouse->m_dragTolerance3D)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mouse.ini:

  DragTolerance = 25                                ; How many pixels should we allow before it is a drag?
  DragTolerance3D = 25                              ; How many feet in worldspace should we allow before it is a drag?
  DragToleranceMS = 250                             ; if the mouse is held down for this long, we consider it a drag, not a click.

This is the only user of m_dragTolerance3D. So we can remove that field as well?

Perhaps the cameraPos.length() > TheMouse->m_dragTolerance3D was meant to be inside isClick function? It looks to be intentional, so I wonder if there is something to it we are missing.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field can indeed be removed. I left it for posterity in case it could be used for something else.

It is a reasonable expectation that right-clicking cancels the active context command regardless of camera movement. It otherwise introduces a seemingly arbitrary behavioural inconsistency (especially as it is dependent on the player's camera scroll speed set in the game options). A player might right-click while moving the camera (or immediately after pressing spacebar or a hotkey to zoom to a location), not realise their command is still active, and then accidentally bomb themselves or a useless location.

I think it probably was meant to be inside isClick, but I cannot come up with any valid cases for keeping the condition.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, judging by the descriptions, it appears to be redundant to DragTolerance.

{
isClick = FALSE;
}

// right click behavior (not right drag)
if (isClick)
if (TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime))
{
//Added support to cancel the GUI command without deselecting the unit(s) involved
//when you right click.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -993,16 +993,8 @@ GameMessageDisposition SelectionTranslator::translateGameMessage(const GameMessa
ICoord2D pixel = msg->getArgument( 0 )->pixel;
UnsignedInt currentTime = (UnsignedInt) msg->getArgument( 2 )->integer;

Bool isClick = TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime);

if (isClick &&
cameraPos.length() > TheMouse->m_dragTolerance3D)
{
isClick = FALSE;
}

// right click behavior (not right drag)
if (isClick)
if (TheMouse->isClick(&m_deselectFeedbackAnchor, &pixel, m_lastClick, currentTime))
{
//Added support to cancel the GUI command without deselecting the unit(s) involved
//when you right click.
Expand Down
Loading