[MSPAINT] Fix ShapeTool with Shift key (#5358)

Fix the behavior of the ShapeTool in pressing Shift key. CORE-18867
This commit is contained in:
Katayama Hirofumi MZ 2023-06-22 07:19:48 +09:00 committed by GitHub
parent e7ccb36b9b
commit 3fa6d74a01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -791,6 +791,9 @@ struct ShapeTool : ToolBase
m_bLeftButton = bLeftButton;
m_bClosed = FALSE;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, x, y);
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
@ -812,12 +815,12 @@ struct ShapeTool : ToolBase
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
{
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y, x, y);
pointStack[pointSP].x = x;
pointStack[pointSP].y = y;
imageModel.NotifyImageChanged();
}