| 126 | } |
| 127 | |
| 128 | void CMapView::ZoomMouseTarget(float ZoomFactor) |
| 129 | { |
| 130 | // zoom to the current mouse position |
| 131 | // get absolute mouse position |
| 132 | float aPoints[4]; |
| 133 | Graphics()->MapScreenToWorld( |
| 134 | GetWorldOffset().x, GetWorldOffset().y, |
| 135 | 100.0f, 100.0f, 100.0f, 0.0f, 0.0f, Graphics()->ScreenAspect(), m_WorldZoom, aPoints); |
| 136 | |
| 137 | float WorldWidth = aPoints[2] - aPoints[0]; |
| 138 | float WorldHeight = aPoints[3] - aPoints[1]; |
| 139 | |
| 140 | float MouseWorldX = aPoints[0] + WorldWidth * (Ui()->MouseX() / Ui()->Screen()->w); |
| 141 | float MouseWorldY = aPoints[1] + WorldHeight * (Ui()->MouseY() / Ui()->Screen()->h); |
| 142 | |
| 143 | // adjust camera |
| 144 | OffsetWorld((vec2(MouseWorldX, MouseWorldY) - GetWorldOffset()) * (1.0f - ZoomFactor)); |
| 145 | } |
| 146 | |
| 147 | void CMapView::UpdateZoom() |
| 148 | { |
nothing calls this directly
no test coverage detected