mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
Everywhere: Use 'increase_slider_by()' method from AbstractSlider
This method help us to avoid repeating the pattern 'set_value(value() + delta)'.
This commit is contained in:
parent
8b8f404146
commit
d53e1fa1fa
12 changed files with 19 additions and 19 deletions
|
@ -107,7 +107,7 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy)
|
|||
m_auto_scroll_timer->on_timeout = [this] {
|
||||
if (m_auto_scroll_direction != AutoScrollDirection::None) {
|
||||
int scroll_amount = m_auto_scroll_direction == AutoScrollDirection::Up ? -1 : 1;
|
||||
m_scrollbar->set_value(m_scrollbar->value() + scroll_amount);
|
||||
m_scrollbar->increase_slider_by(scroll_amount);
|
||||
}
|
||||
};
|
||||
m_auto_scroll_timer->start();
|
||||
|
@ -219,7 +219,7 @@ void TerminalWidget::keydown_event(GUI::KeyEvent& event)
|
|||
return;
|
||||
}
|
||||
if (event.key() == KeyCode::Key_PageDown && event.modifiers() == Mod_Shift) {
|
||||
m_scrollbar->set_value(m_scrollbar->value() + m_terminal.rows());
|
||||
m_scrollbar->increase_slider_by(m_terminal.rows());
|
||||
return;
|
||||
}
|
||||
if (event.key() == KeyCode::Key_Alt) {
|
||||
|
@ -916,7 +916,7 @@ void TerminalWidget::mousewheel_event(GUI::MouseEvent& event)
|
|||
if (!is_scrollable())
|
||||
return;
|
||||
set_auto_scroll_direction(AutoScrollDirection::None);
|
||||
m_scrollbar->set_value(m_scrollbar->value() + event.wheel_delta() * scroll_length());
|
||||
m_scrollbar->increase_slider_by(event.wheel_delta() * scroll_length());
|
||||
GUI::Frame::mousewheel_event(event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue