Shift dragging the time selection moves it

This commit is contained in:
xenakios 2018-02-22 14:49:53 +02:00
parent 7cd5251516
commit e502906d4f

View File

@ -607,32 +607,27 @@ void WaveformComponent::mouseDrag(const MouseEvent & e)
{ {
if (m_didseek == true) if (m_didseek == true)
return; return;
if (m_time_sel_drag_target == 0) if (m_time_sel_drag_target == 0 && e.mods.isAnyModifierKeyDown()==false)
{ {
m_time_sel_start = m_drag_time_start; m_time_sel_start = m_drag_time_start;
m_time_sel_end = viewXToNormalized(e.x); m_time_sel_end = viewXToNormalized(e.x);
} }
if (m_time_sel_drag_target == 0 && e.mods.isShiftDown())
{
double diff = m_drag_time_start - viewXToNormalized(e.x);
m_time_sel_start -= diff;
m_time_sel_end -= diff;
m_drag_time_start -= diff;
}
double curlen = m_time_sel_end-m_time_sel_start; double curlen = m_time_sel_end-m_time_sel_start;
if (m_time_sel_drag_target == 1) if (m_time_sel_drag_target == 1)
{ {
if (e.mods.isShiftDown()==false)
m_time_sel_start = viewXToNormalized(e.x); m_time_sel_start = viewXToNormalized(e.x);
else
{
m_time_sel_start = viewXToNormalized(e.x);
m_time_sel_end = m_time_sel_start+curlen;
}
} }
if (m_time_sel_drag_target == 2) if (m_time_sel_drag_target == 2)
{ {
if (e.mods.isShiftDown()==false)
m_time_sel_end = viewXToNormalized(e.x); m_time_sel_end = viewXToNormalized(e.x);
else
{
m_time_sel_end = viewXToNormalized(e.x);
m_time_sel_start = m_time_sel_end-curlen;
}
} }
if (m_time_sel_start > m_time_sel_end) if (m_time_sel_start > m_time_sel_end)
{ {