MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / UpdateViewportCoordinates

Method UpdateViewportCoordinates

src/widget.cpp:2430–2442  ·  view source on GitHub ↗

* Update the position and size of the viewport (after eg a resize). * @param w Window owning the viewport. */

Source from the content-addressed store, hash-verified

2428 * @param w Window owning the viewport.
2429 */
2430void 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.

Callers 7

OnResizeMethod · 0.80
OnResizeMethod · 0.80
OnResizeMethod · 0.80
OnResizeMethod · 0.80
OnResizeMethod · 0.80
OnResizeMethod · 0.80
OnResizeMethod · 0.80

Calls 1

ScaleByZoomFunction · 0.85

Tested by

no test coverage detected