[MSPAINT] Reset scroll position in some situations (#5789)

In some situations, the scroll position should be reset.
- Add CCanvasWindow::resetScrollPos method.
- Reset the scroll position on loading a file.
- Reset the scroll position on mirroring/rotating
  the image.
CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-10-12 22:59:17 +09:00 committed by GitHub
parent 9a51c8e6c6
commit 1183e797b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 0 deletions

View file

@ -199,6 +199,12 @@ VOID CCanvasWindow::updateScrollInfo()
SetScrollInfo(SB_VERT, &si);
}
VOID CCanvasWindow::resetScrollPos()
{
SetScrollPos(SB_HORZ, 0);
SetScrollPos(SB_VERT, 0);
}
LRESULT CCanvasWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if (m_hWnd)

View file

@ -43,6 +43,7 @@ public:
VOID cancelDrawing();
VOID finishDrawing();
VOID updateScrollInfo();
VOID resetScrollPos();
VOID ImageToCanvas(POINT& pt);
VOID ImageToCanvas(RECT& rc);

View file

@ -241,6 +241,7 @@ HBITMAP InitializeImage(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
HBITMAP SetBitmapAndInfo(HBITMAP hBitmap, LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isFile)
{
// update image
canvasWindow.resetScrollPos();
imageModel.PushImageForUndo(hBitmap);
imageModel.ClearHistory();

View file

@ -921,6 +921,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
case IDM_IMAGEROTATEMIRROR:
{
CWaitCursor waitCursor;
canvasWindow.resetScrollPos();
switch (mirrorRotateDialog.DoModal(mainWindow.m_hWnd))
{
case 1: /* flip horizontally */