Nauwkeuriger

svn path=/Slnkdwf/trunk/; revision=12527
This commit is contained in:
Jos Groot Lipman
2011-09-14 20:46:30 +00:00
parent a406551a1e
commit 84ce5e037d

View File

@@ -1450,8 +1450,18 @@ public:
return;
pT->ViewDPtoLP(&pt);
POINT p0;
pT->GetScrollOffset(p0); // laatste kans om oude offset op te halen
RECT rc;
::GetClientRect(pT->m_hWnd, &rc);
CPoint newpt((LONG)((p0.x+x)/m_fZoomScale*fZoomScale-rc.right/2.0 + 0.5),
(LONG)((p0.y+y)/m_fZoomScale*fZoomScale-rc.bottom/2.0 + 0.5));
pT->Zoom(fZoomScale, false);
pT->CenterOnLogicalPoint(pt);
// pT->CenterOnLogicalPoint(pt);
pT->SetScrollOffset(newpt);
}
void Zoom(POINT pt, float fZoomScale)
@@ -1519,8 +1529,31 @@ public:
ATLASSERT(m_sizeAll.cx >= 0 && m_sizeAll.cy >= 0);
dc.SetMapMode(MM_ANISOTROPIC);
dc.SetWindowExt(m_sizeLogAll);
dc.SetViewportExt(m_sizeAll);
dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y);
if (0) // JGL http://tech.groups.yahoo.com/group/wtl/message/14024
{
dc.SetViewportExt(m_sizeAll);
dc.SetViewportOrg(-m_ptOffset.x, -m_ptOffset.y);
}
else
{
// [RES-Begin Changes]
// if client area is larger than total device size,
// override scroll positions to place origin such that
// output is centered in the window
T* pT = static_cast<T*>(this);
CPoint ptOffset(m_ptOffset);
CRect rect;
::GetClientRect(pT->m_hWnd, &rect);
if (m_sizeAll.cx < rect.Width())
ptOffset.x = (m_sizeAll.cx - rect.Width()) / 2;
if (m_sizeAll.cy < rect.Height())
ptOffset.y = (m_sizeAll.cy - rect.Height()) / 2;
// [RES-End Changes]
dc.SetViewportExt(m_sizeAll);
dc.SetViewportOrg(-ptOffset.x, -ptOffset.y);
}
}
void ViewDPtoLP(LPPOINT lpPoints, int nCount = 1)