* Update the position and size of the viewport (after eg a resize). * @param w Window owning the viewport. */
| 2428 | * @param w Window owning the viewport. |
| 2429 | */ |
| 2430 | void NWidgetViewport::UpdateViewportCoordinates(Window *w) |
| 2431 | { |
| 2432 | if (w->viewport == nullptr) return; |
| 2433 | |
| 2434 | Viewport &vp = *w->viewport; |
| 2435 | vp.left = w->left + this->pos_x; |
| 2436 | vp.top = w->top + this->pos_y; |
| 2437 | vp.width = this->current_x; |
| 2438 | vp.height = this->current_y; |
| 2439 | |
| 2440 | vp.virtual_width = ScaleByZoom(vp.width, vp.zoom); |
| 2441 | vp.virtual_height = ScaleByZoom(vp.height, vp.zoom); |
| 2442 | } |
| 2443 | |
| 2444 | /** |
| 2445 | * Compute the row of a scrolled widget that a user clicked in. |