* Test whether a sign is below the mouse * @param vp the clicked viewport * @param x X position of click * @param y Y position of click * @param sign the sign to check * @return true if the sign was hit */
| 2268 | * @return true if the sign was hit |
| 2269 | */ |
| 2270 | static bool CheckClickOnViewportSign(const Viewport &vp, int x, int y, const ViewportSign *sign) |
| 2271 | { |
| 2272 | bool small = (vp.zoom >= ZoomLevel::Out4x); |
| 2273 | int sign_half_width = ScaleByZoom((small ? sign->width_small : sign->width_normal) / 2, vp.zoom); |
| 2274 | int sign_height = ScaleByZoom(WidgetDimensions::scaled.fullbevel.top + GetCharacterHeight(small ? FS_SMALL : FS_NORMAL) + WidgetDimensions::scaled.fullbevel.bottom, vp.zoom); |
| 2275 | |
| 2276 | return y >= sign->top && y < sign->top + sign_height && |
| 2277 | x >= sign->center - sign_half_width && x < sign->center + sign_half_width; |
| 2278 | } |
| 2279 | |
| 2280 | |
| 2281 | /** |
no test coverage detected