fixed quad selection via envelope preview

This commit is contained in:
oy 2011-08-16 21:35:00 +02:00
parent f36cc57bdd
commit 2708256186

View file

@ -1501,6 +1501,7 @@ void CEditor::DoQuadEnvPoint(CQuad *pQuad, int QIndex, int PIndex)
float wy = UI()->MouseWorldY();
CEnvelope *pEnvelope = m_Map.m_lEnvelopes[pQuad->m_PosEnv];
void *pID = &pEnvelope->m_lPoints[PIndex];
static int s_ActQIndex = -1;
// get pivot
float CenterX = fx2f(pQuad->m_aPoints[4].x)+fx2f(pEnvelope->m_lPoints[PIndex].m_aValues[0]);
@ -1508,10 +1509,13 @@ void CEditor::DoQuadEnvPoint(CQuad *pQuad, int QIndex, int PIndex)
float dx = (CenterX - wx)/m_WorldZoom;
float dy = (CenterY - wy)/m_WorldZoom;
if(dx*dx+dy*dy < 50)
if(dx*dx+dy*dy < 50.0f && UI()->ActiveItem() == 0)
{
UI()->SetHotItem(pID);
s_ActQIndex = QIndex;
}
if(UI()->ActiveItem() == pID)
if(UI()->ActiveItem() == pID && s_ActQIndex == QIndex)
{
if(s_Operation == OP_MOVE)
{
@ -1554,7 +1558,7 @@ void CEditor::DoQuadEnvPoint(CQuad *pQuad, int QIndex, int PIndex)
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
}
else if(UI()->HotItem() == pID)
else if(UI()->HotItem() == pID && s_ActQIndex == QIndex)
{
ms_pUiGotContext = pID;