Remove the correct syllable split on a click on the left side of the split line

This commit is contained in:
Thomas Goyne 2012-10-05 08:21:29 -07:00
parent 5cdcd3dcb3
commit de862cb6e8
1 changed files with 4 additions and 4 deletions

View File

@ -315,9 +315,9 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
// If the click is sufficiently close to a line of a syllable split, // If the click is sufficiently close to a line of a syllable split,
// remove that split rather than adding a new one // remove that split rather than adding a new one
click_will_remove_split = bool click_right = (syl > 0 && shifted_pos <= syl_lines[syl - 1] + 3);
(syl > 0 && shifted_pos <= syl_lines[syl - 1] + 3) || bool click_left = (syl < (int)syl_lines.size() && shifted_pos >= syl_lines[syl] - 3);
(syl < (int)syl_lines.size() && shifted_pos >= syl_lines[syl] - 3); click_will_remove_split = click_left || click_right;
if (!event.LeftDown()) { if (!event.LeftDown()) {
// Erase the old line and draw the new one // Erase the old line and draw the new one
@ -326,7 +326,7 @@ void AudioKaraoke::OnMouse(wxMouseEvent &event) {
} }
if (click_will_remove_split) { if (click_will_remove_split) {
kara->RemoveSplit(syl); kara->RemoveSplit(syl + (click_left && !click_right));
} }
else { else {
kara->AddSplit(syl, split_pos - syl_start_points[syl]); kara->AddSplit(syl, split_pos - syl_start_points[syl]);