take Snap enablement into account when drawing new notes

* snap_to_bbt assumes that snap is enabled and you want to snap to bbt
* snap_to() is the generic form to snap to the user's snap+grid settings
This commit is contained in:
Ben Loftis 2022-05-11 11:38:54 -05:00
parent de9f18b4f9
commit a60dfc19d2
2 changed files with 5 additions and 2 deletions

View File

@ -6839,7 +6839,9 @@ NoteCreateDrag::~NoteCreateDrag ()
Temporal::Beats
NoteCreateDrag::round_down_to_grid (timepos_t const & pos, GdkEvent const * event) const
{
return _editor->snap_to_bbt (pos, RoundDownMaybe, SnapToGrid_Unscaled).beats ();
timepos_t snapped = pos;
_editor->snap_to (snapped, RoundDownMaybe, SnapToGrid_Unscaled);
return snapped.beats();
}
void

View File

@ -4092,7 +4092,8 @@ MidiRegionView::update_ghost_note (double x, double y, uint32_t state)
PublicEditor& editor = trackview.editor ();
samplepos_t const unsnapped_sample = editor.pixel_to_sample (global_x);
const Temporal::timepos_t snapped_pos = editor.snap_to_bbt (timepos_t (unsnapped_sample), RoundDownAlways, SnapToGrid_Unscaled);
Temporal::timepos_t snapped_pos = timepos_t (unsnapped_sample);
editor.snap_to (snapped_pos, RoundDownAlways, SnapToGrid_Unscaled);
const Temporal::Beats snapped_beats = _region->position().distance (snapped_pos).beats ();
/* prevent Percussive mode from displaying a ghost hit at region end */