Fixed wrong cursor when the mouse is over the view cube and other objects at the same time.

This commit is contained in:
Leonardo Zide 2018-09-19 12:56:45 -07:00
parent 7ba01dbff7
commit f507e08cde
3 changed files with 21 additions and 9 deletions

View file

@ -295,15 +295,11 @@ bool lcViewCube::OnMouseMove()
if (Location == lcViewCubeLocation::DISABLED)
return false;
if (mMouseDown)
if (IsDragging())
{
if (qAbs(mMouseDownX - mView->mInputState.x) > 3 || qAbs(mMouseDownY - mView->mInputState.y) > 3)
{
mIntersectionFlags.reset();
mMouseDown = false;
mView->StartOrbitTracking();
return true;
}
mIntersectionFlags.reset();
mView->StartOrbitTracking();
return true;
}
if (mView->IsTracking())
@ -352,5 +348,10 @@ bool lcViewCube::OnMouseMove()
mView->Redraw();
}
return true;
return mIntersectionFlags.any();
}
bool lcViewCube::IsDragging() const
{
return mMouseDown && (qAbs(mMouseDownX - mView->mInputState.x) > 3 || qAbs(mMouseDownY - mView->mInputState.y) > 3);
}

View file

@ -14,6 +14,7 @@ public:
bool OnMouseMove();
bool OnLeftButtonUp();
bool OnLeftButtonDown();
bool IsDragging() const;
protected:
lcMatrix44 GetViewMatrix() const;

View file

@ -2878,7 +2878,17 @@ void View::OnMouseMove()
if (mTrackButton == LC_TRACKBUTTON_NONE)
{
if (mViewCube.OnMouseMove())
{
lcTrackTool NewTrackTool = mViewCube.IsDragging() ? LC_TRACKTOOL_ORBIT_XY : LC_TRACKTOOL_NONE;
if (NewTrackTool != mTrackTool)
{
mTrackTool = NewTrackTool;
OnUpdateCursor();
}
return;
}
UpdateTrackTool();