Improved envelope component keyboard handling logic
This commit is contained in:
parent
c6c2855a56
commit
d95c41e8aa
@ -313,19 +313,30 @@ bool EnvelopeComponent::keyPressed(const KeyPress & ev)
|
|||||||
{
|
{
|
||||||
if (m_envelope == nullptr)
|
if (m_envelope == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
auto f = [this](auto& env_var, double amt)
|
||||||
|
{
|
||||||
|
env_var+=amt;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
bool r = false;
|
||||||
if (ev == 'Q')
|
if (ev == 'Q')
|
||||||
m_envelope->m_transform_x_shift -= 0.01;
|
r = f(m_envelope->m_transform_x_shift,-0.01);
|
||||||
if (ev == 'W')
|
if (ev == 'W')
|
||||||
m_envelope->m_transform_x_shift += 0.01;
|
r = f(m_envelope->m_transform_x_shift,0.01);
|
||||||
if (ev == 'E')
|
if (ev == 'E')
|
||||||
m_envelope->m_transform_y_shift += 0.01;
|
r = f(m_envelope->m_transform_y_shift,0.01);
|
||||||
if (ev == 'D')
|
if (ev == 'D')
|
||||||
m_envelope->m_transform_y_shift -= 0.01;
|
r = f(m_envelope->m_transform_y_shift,-0.01);
|
||||||
if (ev == 'R')
|
if (ev == 'R')
|
||||||
m_envelope->m_transform_y_scale += 0.05;
|
r = f(m_envelope->m_transform_y_scale,0.05);
|
||||||
if (ev == 'F')
|
if (ev == 'F')
|
||||||
m_envelope->m_transform_y_scale -= 0.05;
|
r = f(m_envelope->m_transform_y_scale,-0.05);
|
||||||
|
if (r==true)
|
||||||
|
{
|
||||||
repaint();
|
repaint();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ev == KeyPress::deleteKey)
|
if (ev == KeyPress::deleteKey)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user