22 m_translation = wxPoint2DDouble(0, 0);
27wxPoint2DDouble Camera::ScreenToWorld(wxPoint2DDouble screenCoords)
const
29 return wxPoint2DDouble(screenCoords.m_x / m_scale - m_translation.m_x,
30 screenCoords.m_y / m_scale - m_translation.m_y);
33void Camera::SetTranslation(wxPoint2DDouble screenPoint)
35 m_translation = screenPoint / m_scale - m_translationStartPt;
38void Camera::SetScale(wxPoint2DDouble screenPoint,
double delta)
40 m_translation -= screenPoint * (1.0 - m_scale) / m_scale;
45 if(m_scale < m_zoomMin) m_scale = m_zoomMin;
46 if(m_scale > m_zoomMax) m_scale = m_zoomMax;
48 m_translation += screenPoint * (1.0 - m_scale) / m_scale;
51wxPoint2DDouble Camera::GetMousePosition(
bool worldCoords)
const
53 if(worldCoords)
return ScreenToWorld(m_mousePosition);
54 return m_mousePosition;