| 368 | } |
| 369 | |
| 370 | bool Chat::sendEvent(InputEvent const& event) { |
| 371 | if (!m_scripted && active()) { |
| 372 | if (hasFocus()) { |
| 373 | if (event.is<KeyDownEvent>()) { |
| 374 | auto actions = context()->actions(event); |
| 375 | if (actions.contains(InterfaceAction::ChatStop)) { |
| 376 | stopChat(); |
| 377 | return true; |
| 378 | } else if (actions.contains(InterfaceAction::ChatPreviousLine)) { |
| 379 | incrementIndex(); |
| 380 | return true; |
| 381 | } else if (actions.contains(InterfaceAction::ChatNextLine)) { |
| 382 | decrementIndex(); |
| 383 | return true; |
| 384 | } else if (actions.contains(InterfaceAction::ChatPageDown)) { |
| 385 | scrollDown(); |
| 386 | return true; |
| 387 | } else if (actions.contains(InterfaceAction::ChatPageUp)) { |
| 388 | scrollUp(); |
| 389 | return true; |
| 390 | } |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | if (auto mouseWheel = event.ptr<MouseWheelEvent>()) { |
| 395 | if (inMember(*context()->mousePosition(event))) { |
| 396 | if (mouseWheel->mouseWheel == MouseWheel::Down) |
| 397 | scrollDown(); |
| 398 | else |
| 399 | scrollUp(); |
| 400 | return true; |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | if (event.is<MouseMoveEvent>() && inMember(*context()->mousePosition(event))) |
| 405 | m_timeChatLastActive = Time::monotonicMilliseconds(); |
| 406 | |
| 407 | if (event.is<MouseButtonDownEvent>()) { |
| 408 | if (m_chatLog->inMember(*context()->mousePosition(event))) { |
| 409 | m_expanded = !m_expanded; |
| 410 | updateSize(); |
| 411 | return true; |
| 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | return Pane::sendEvent(event); |
| 417 | } |
| 418 | |
| 419 | void Chat::scrollUp() { |
| 420 | auto shownMessages = m_receivedMessages.filtered([=](LogMessage msg) { |
no test coverage detected