[MSPAINT] Improve Zoom tool (#5781)

- Delete CCanvasWindow::drawZoomFrame.
- Invalidate the canvas on mouse move when
  the active tool is Zoom tool.
- Add ZoomTool::OnDrawOverlayOnCanvas to
  draw the zoom rectangle without flickering.
- Improve the zoom trackbar position.
- Display the zoom rate on changing the value
  of the zoom trackbar.
- Reverse the direction of the zoom trackbar.
- Don't draw the focus rectangle.
CORE-19215, CORE-19216
This commit is contained in:
Katayama Hirofumi MZ 2023-10-10 10:59:29 +09:00 committed by GitHub
parent 0c164f081a
commit 62eeb158a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 31 deletions

View file

@ -29,18 +29,6 @@ CCanvasWindow::~CCanvasWindow()
::DeleteObject(m_ahbmCached[1]);
}
VOID CCanvasWindow::drawZoomFrame(INT mouseX, INT mouseY)
{
// FIXME: Draw the border of the area that is to be zoomed in
CRect rc;
GetImageRect(rc);
ImageToCanvas(rc);
HDC hdc = GetDC();
DrawXorRect(hdc, &rc);
ReleaseDC(hdc);
}
RECT CCanvasWindow::GetBaseRect()
{
CRect rcBase;
@ -376,6 +364,9 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
CanvasToImage(pt);
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
Invalidate();
if (m_hitSelection != HIT_NONE)
{
SelectionDragging(pt);
@ -384,14 +375,6 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
if (!m_drawing || toolsModel.GetActiveTool() <= TOOL_AIRBRUSH)
{
if (toolsModel.GetActiveTool() == TOOL_ZOOM)
{
Invalidate(FALSE);
UpdateWindow();
CanvasToImage(pt);
drawZoomFrame(pt.x, pt.y);
}
TRACKMOUSEEVENT tme = { sizeof(tme) };
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = m_hWnd;