void CBaseView::OnPanUp() { if (m_graph->xf.zoomPan(0, 50)) { OnZoomed(); } }
void CBaseView::OnPanDown() { if (m_graph->xf.zoomPan(0, -50)) { OnZoomed(); } }
void CBaseView::OnPanLeft() { if (m_graph->xf.zoomPan(50, 0)) { OnZoomed(); } }
void CBaseView::OnPanRight() { if (m_graph->xf.zoomPan(-50, 0)) { OnZoomed(); } }
void CBaseView::OnZoomExtent() { if (m_graph->xf.zoomTo(m_shapes->getExtent() * m_graph->xf.modelToWorld(), NULL)) { OnZoomed(); } }
void CBaseView::OnZoomOut() { if (m_graph->xf.zoomByFactor(-0.2f)) { OnZoomed(); } }
void CDrawShapeView::OnInitialUpdate() { if (!m_filename.IsEmpty()) { m_graph->xf.setModelTransform(shapes()->modelTransform()); m_graph->xf.zoomTo(shapes()->getZoomRectW()); m_graph->xf.zoomScale(shapes()->getViewScale()); OnZoomed(); } }
void CBaseView::OnSize(UINT nType, int cx, int cy) { CWnd::OnSize(nType, cx, cy); // 设置显示窗口的大小为客户区大小(不包含滚动条) if (nType != SIZE_MINIMIZED && cx > 1 && cy > 1) { m_graph->xf.setWndSize(cx, cy); OnZoomed(); } }
BOOL CBaseView::OnMouseWheel(UINT nFlags, short zDelta, CPoint) { if (nFlags & MK_LBUTTON) return FALSE; // (Ctrl或空格)+滚动: 放缩显示 if ((nFlags & MK_CONTROL) || GetAsyncKeyState(VK_SPACE) < 0) { if (m_graph->xf.zoomByFactor(zDelta > 0 ? 0.2f : -0.2f)) OnZoomed(); } else if (nFlags & MK_SHIFT) { // Shift+滚动: 左右平移, nFlags=0xFF SendMessage(WM_KEYDOWN, zDelta > 0 ? VK_LEFT : VK_RIGHT, 0xFF0000); } else { SendMessage(WM_KEYDOWN, zDelta > 0 ? VK_UP : VK_DOWN, 0xFF0000); } return TRUE; }
void CBaseView::OnPanDown() { if (m_graph->xf.zoomPan(0, -(float)m_graph->xf.getHeight() / 4)) OnZoomed(); }
void CBaseView::OnPanRight() { if (m_graph->xf.zoomPan(-(float)m_graph->xf.getWidth() / 4, 0)) OnZoomed(); }
void CBaseView::OnZoomIn() { if (m_graph->xf.zoomByFactor(0.5f)) OnZoomed(); }