Avoid mouse drag when the spectral module enable button has been clicked
This commit is contained in:
parent
6745f5443b
commit
d119439f76
@ -719,7 +719,7 @@ void SpectralChainEditor::setSource(StretchAudioSource * src)
|
|||||||
void SpectralChainEditor::mouseDown(const MouseEvent & ev)
|
void SpectralChainEditor::mouseDown(const MouseEvent & ev)
|
||||||
{
|
{
|
||||||
m_did_drag = false;
|
m_did_drag = false;
|
||||||
int box_w = getWidth() / m_order.size();
|
int box_w = getWidth() / m_order.size();
|
||||||
int box_h = getHeight();
|
int box_h = getHeight();
|
||||||
m_cur_index = ev.x / box_w;
|
m_cur_index = ev.x / box_w;
|
||||||
if (m_cur_index >= 0)
|
if (m_cur_index >= 0)
|
||||||
@ -730,7 +730,7 @@ void SpectralChainEditor::mouseDown(const MouseEvent & ev)
|
|||||||
m_order[m_cur_index].m_enabled = !m_order[m_cur_index].m_enabled;
|
m_order[m_cur_index].m_enabled = !m_order[m_cur_index].m_enabled;
|
||||||
m_src->setSpectrumProcessOrder(m_order);
|
m_src->setSpectrumProcessOrder(m_order);
|
||||||
repaint();
|
repaint();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_drag_x = -1;
|
m_drag_x = -1;
|
||||||
@ -739,9 +739,13 @@ void SpectralChainEditor::mouseDown(const MouseEvent & ev)
|
|||||||
|
|
||||||
void SpectralChainEditor::mouseDrag(const MouseEvent & ev)
|
void SpectralChainEditor::mouseDrag(const MouseEvent & ev)
|
||||||
{
|
{
|
||||||
if (m_cur_index >= 0 && m_cur_index < m_order.size())
|
int box_w = getWidth() / m_order.size();
|
||||||
|
juce::Rectangle<int> r(box_w*m_cur_index, 1, 12, 12);
|
||||||
|
if (r.contains(ev.x, ev.y))
|
||||||
|
return;
|
||||||
|
if (m_cur_index >= 0 && m_cur_index < m_order.size())
|
||||||
{
|
{
|
||||||
int box_w = getWidth() / m_order.size();
|
|
||||||
int box_h = getHeight();
|
int box_h = getHeight();
|
||||||
int new_index = ev.x / box_w;
|
int new_index = ev.x / box_w;
|
||||||
if (new_index >= 0 && new_index < m_order.size() && new_index != m_cur_index)
|
if (new_index >= 0 && new_index < m_order.size() && new_index != m_cur_index)
|
||||||
|
@ -156,7 +156,7 @@ private:
|
|||||||
bool m_did_drag = false;
|
bool m_did_drag = false;
|
||||||
int m_cur_index = -1;
|
int m_cur_index = -1;
|
||||||
int m_drag_x = 0;
|
int m_drag_x = 0;
|
||||||
std::vector<SpectrumProcess> m_order;
|
std::vector<SpectrumProcess> m_order;
|
||||||
void drawBox(Graphics& g, int index, int x, int y, int w, int h);
|
void drawBox(Graphics& g, int index, int x, int y, int w, int h);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user