midi_region_view: use absolute_time_to_region_beats

* this fixes the location of the 'ghost note' that is shown
 when adding notes with the Draw tool
This commit is contained in:
Ben Loftis 2022-05-12 11:59:47 -05:00
parent 1fdfa53b9f
commit 41815f8d53
1 changed files with 2 additions and 1 deletions

View File

@ -4094,7 +4094,8 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
samplepos_t const unsnapped_sample = editor.pixel_to_sample (global_x);
Temporal::timepos_t snapped_pos = timepos_t (unsnapped_sample);
editor.snap_to (snapped_pos, RoundDownAlways, SnapToGrid_Scaled);
const Temporal::Beats snapped_beats = _region->position().distance (snapped_pos).beats ();
const Temporal::Beats snapped_beats = _region->absolute_time_to_region_beats(snapped_pos);
/* prevent Percussive mode from displaying a ghost hit at region end */
if ((midi_view()->note_mode() == Percussive) && (snapped_beats >= _region->length().beats())) {