mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-22 10:19:20 +00:00
Piano: Highlight pressed key in roll widget
This commit is contained in:
parent
0c5497829e
commit
01bff0141e
Notes:
sideshowbarker
2024-07-19 01:55:52 +09:00
Author: https://github.com/petelliott
Commit: 01bff0141e
Pull-request: https://github.com/SerenityOS/serenity/pull/3746
6 changed files with 25 additions and 1 deletions
|
@ -92,6 +92,8 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
|
|||
|
||||
for (int y = 0; y < notes_to_paint; ++y) {
|
||||
int y_pos = y * note_height;
|
||||
|
||||
int note = (note_count - note_offset - 1) - y;
|
||||
for (int x = 0; x < horizontal_notes_to_paint; ++x) {
|
||||
// This is needed to avoid rounding errors. You can't just use
|
||||
// m_note_width as the width.
|
||||
|
@ -105,6 +107,9 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
|
|||
else
|
||||
painter.fill_rect(rect, Color::White);
|
||||
|
||||
if (keys_widget() && keys_widget()->note_is_set(note))
|
||||
painter.fill_rect(rect, note_pressed_color.with_alpha(128));
|
||||
|
||||
painter.draw_line(rect.top_right(), rect.bottom_right(), Color::Black);
|
||||
painter.draw_line(rect.bottom_left(), rect.bottom_right(), Color::Black);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue