From 1e23b8b2563cb521ee5963175a592d2aef98ed8f Mon Sep 17 00:00:00 2001 From: Petr Gladkikh Date: Mon, 16 Dec 2024 19:29:47 +0400 Subject: [PATCH] Backport hover highlight from events-revamp --- src/stave.rs | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/stave.rs b/src/stave.rs index 2c266a2..ecadb8e 100644 --- a/src/stave.rs +++ b/src/stave.rs @@ -24,10 +24,11 @@ use crate::track_edit::{ use crate::track_history::{CommandApplication, TrackHistory}; use crate::{util, Pix}; -// Tone 60 is C3, tones start at C-2 (21). +// Tone 60 is C3, tones start at C-2 (tone 21). const PIANO_LOWEST_KEY: Pitch = 21; const PIANO_KEY_COUNT: Pitch = 88; -const PIANO_DAMPER_LINE: Pitch = PIANO_LOWEST_KEY - 1; +/// Reserve this ley lane for damper display. +const PIANO_DAMPER_LANE: Pitch = PIANO_LOWEST_KEY - 1; pub(crate) const PIANO_KEY_LINES: Range = PIANO_LOWEST_KEY..(PIANO_LOWEST_KEY + PIANO_KEY_COUNT); // Lines including controller values placeholder. @@ -247,8 +248,7 @@ impl Stave { should_be_visible = self.draw_track( &key_ys, &half_tone_step, - &pitch_hovered, - &time_hovered, + &pointer_pos, &mut note_hovered, &painter, &track, @@ -292,8 +292,7 @@ impl Stave { &self, key_ys: &BTreeMap, half_tone_step: &Pix, - pitch_hovered: &Option, - time_hovered: &Option