Prevent mouse shortcuts from overriding overlay actions. Fixes #180.

This commit is contained in:
Leonardo Zide 2018-02-06 14:47:11 -08:00
parent 8334f2d877
commit 752ee5c4e7
2 changed files with 14 additions and 1 deletions

View file

@ -22,6 +22,7 @@ View::View(lcModel* Model)
mDragState = LC_DRAGSTATE_NONE; mDragState = LC_DRAGSTATE_NONE;
mTrackButton = LC_TRACKBUTTON_NONE; mTrackButton = LC_TRACKBUTTON_NONE;
mTrackTool = LC_TRACKTOOL_NONE; mTrackTool = LC_TRACKTOOL_NONE;
mTrackToolFromOverlay = false;
View* ActiveView = gMainWindow->GetActiveView(); View* ActiveView = gMainWindow->GetActiveView();
if (ActiveView) if (ActiveView)
@ -1745,6 +1746,9 @@ lcTool View::GetCurrentTool() const
lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const lcTrackTool View::GetOverrideTrackTool(Qt::MouseButton Button) const
{ {
if (mTrackToolFromOverlay)
return LC_TRACKTOOL_NONE;
lcTool OverrideTool = gMouseShortcuts.GetTool(Button, mInputState.Modifiers); lcTool OverrideTool = gMouseShortcuts.GetTool(Button, mInputState.Modifiers);
if (OverrideTool == LC_NUM_TOOLS) if (OverrideTool == LC_NUM_TOOLS)
@ -1835,6 +1839,7 @@ void View::UpdateTrackTool()
int x = mInputState.x; int x = mInputState.x;
int y = mInputState.y; int y = mInputState.y;
bool Redraw = false; bool Redraw = false;
mTrackToolFromOverlay = false;
switch (CurrentTool) switch (CurrentTool)
{ {
@ -1873,7 +1878,6 @@ void View::UpdateTrackTool()
if (!mModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation)) if (!mModel->GetMoveRotateTransform(OverlayCenter, RelativeRotation))
break; break;
// Intersect the mouse with the 3 planes.
lcVector3 PlaneNormals[3] = lcVector3 PlaneNormals[3] =
{ {
lcVector3(1.0f, 0.0f, 0.0f), lcVector3(1.0f, 0.0f, 0.0f),
@ -2028,6 +2032,7 @@ void View::UpdateTrackTool()
} }
} }
mTrackToolFromOverlay = NewTrackTool != LC_TRACKTOOL_MOVE_XYZ && NewTrackTool != LC_TRACKTOOL_SELECT;
Redraw = true; Redraw = true;
} }
break; break;
@ -2166,6 +2171,7 @@ void View::UpdateTrackTool()
break; break;
} }
mTrackToolFromOverlay = true;
Dist *= r; Dist *= r;
break; break;
} }
@ -2213,10 +2219,16 @@ void View::UpdateTrackTool()
if ((d < r + SquareSize) && (d > r - SquareSize)) if ((d < r + SquareSize) && (d > r - SquareSize))
{ {
if ((cx - x < SquareSize) && (cx - x > -SquareSize)) if ((cx - x < SquareSize) && (cx - x > -SquareSize))
{
NewTrackTool = LC_TRACKTOOL_ORBIT_Y; NewTrackTool = LC_TRACKTOOL_ORBIT_Y;
mTrackToolFromOverlay = true;
}
if ((cy - y < SquareSize) && (cy - y > -SquareSize)) if ((cy - y < SquareSize) && (cy - y > -SquareSize))
{
NewTrackTool = LC_TRACKTOOL_ORBIT_X; NewTrackTool = LC_TRACKTOOL_ORBIT_X;
mTrackToolFromOverlay = true;
}
} }
else else
{ {

View file

@ -161,6 +161,7 @@ protected:
lcDragState mDragState; lcDragState mDragState;
lcTrackButton mTrackButton; lcTrackButton mTrackButton;
lcTrackTool mTrackTool; lcTrackTool mTrackTool;
bool mTrackToolFromOverlay;
bool mTrackUpdated; bool mTrackUpdated;
int mMouseDownX; int mMouseDownX;
int mMouseDownY; int mMouseDownY;