| 311 | } |
| 312 | |
| 313 | WindowHitCodes SDLWindow::OnWindowHit(const Float2 point) |
| 314 | { |
| 315 | WindowHitCodes hit = WindowHitCodes::Client; |
| 316 | if (!IsFullscreen()) |
| 317 | { |
| 318 | Float2 screenPosition = ClientToScreen(point); |
| 319 | bool handled = false; |
| 320 | OnHitTest(screenPosition, hit, handled); |
| 321 | if (!handled) |
| 322 | { |
| 323 | int margin = _settings.HasBorder ? 0 : 0; |
| 324 | auto size = GetClientSize(); |
| 325 | //if (point.Y < 0) |
| 326 | // hit = WindowHitCodes::Caption; |
| 327 | if (point.Y < margin && point.X < margin) |
| 328 | hit = WindowHitCodes::TopLeft; |
| 329 | else if (point.Y < margin && point.X > size.X - margin) |
| 330 | hit = WindowHitCodes::TopRight; |
| 331 | else if (point.Y < margin) |
| 332 | hit = WindowHitCodes::Top; |
| 333 | else if (point.X < margin && point.Y > size.Y - margin) |
| 334 | hit = WindowHitCodes::BottomLeft; |
| 335 | else if (point.X < margin) |
| 336 | hit = WindowHitCodes::Left; |
| 337 | else if (point.X > size.X - margin && point.Y > size.Y - margin) |
| 338 | hit = WindowHitCodes::BottomRight; |
| 339 | else if (point.X > size.X - margin) |
| 340 | hit = WindowHitCodes::Right; |
| 341 | else if (point.Y > size.Y - margin) |
| 342 | hit = WindowHitCodes::Bottom; |
| 343 | else |
| 344 | hit = WindowHitCodes::Client; |
| 345 | } |
| 346 | } |
| 347 | return hit; |
| 348 | } |
| 349 | |
| 350 | SDL_HitTestResult OnWindowHitTest(SDL_Window* win, const SDL_Point* area, void* data) |
| 351 | { |
no test coverage detected