| 408 | } |
| 409 | |
| 410 | static void edgeScroll() |
| 411 | { |
| 412 | if (!Ui::hasInputFocus()) |
| 413 | { |
| 414 | return; |
| 415 | } |
| 416 | |
| 417 | if (Tutorial::state() != Tutorial::State::none) |
| 418 | { |
| 419 | return; |
| 420 | } |
| 421 | |
| 422 | if (!Config::get().edgeScrolling) |
| 423 | { |
| 424 | return; |
| 425 | } |
| 426 | |
| 427 | if (Input::state() != State::normal && Input::state() != State::dropdownActive) |
| 428 | { |
| 429 | return; |
| 430 | } |
| 431 | |
| 432 | if (hasKeyModifier(KeyModifier::shift) || hasKeyModifier(KeyModifier::control)) |
| 433 | { |
| 434 | return; |
| 435 | } |
| 436 | |
| 437 | Ui::Point delta = { 0, 0 }; |
| 438 | auto cursor = getCursorPosScaled(); |
| 439 | |
| 440 | if (cursor.x == 0) |
| 441 | { |
| 442 | delta.x -= Config::get().edgeScrollingSpeed; |
| 443 | } |
| 444 | |
| 445 | if (cursor.x >= Ui::width() - 1) |
| 446 | { |
| 447 | delta.x += Config::get().edgeScrollingSpeed; |
| 448 | } |
| 449 | |
| 450 | if (cursor.y == 0) |
| 451 | { |
| 452 | delta.y -= Config::get().edgeScrollingSpeed; |
| 453 | } |
| 454 | |
| 455 | if (cursor.y >= Ui::height() - 1) |
| 456 | { |
| 457 | delta.y += Config::get().edgeScrollingSpeed; |
| 458 | } |
| 459 | |
| 460 | if (delta.x == 0 && delta.y == 0) |
| 461 | { |
| 462 | return; |
| 463 | } |
| 464 | |
| 465 | auto main = WindowManager::getMainWindow(); |
| 466 | if (main->hasFlags(WindowFlags::viewportNoScrolling)) |
| 467 | { |
no test coverage detected