@@ -1476,45 +1476,30 @@ void BR_MouseInfo::GetTrackOrEnvelopeFromY (int y, TrackEnvelope** _envelope, Me
1476
1476
TrackEnvelope* envelope = NULL ;
1477
1477
if (track)
1478
1478
{
1479
+ const bool yInTrack = y < elementOffset + elementHeight;
1480
+ const int count = CountTrackEnvelopes (track);
1479
1481
elementHeight = GetTrackHeightWithSpacer (track);
1480
- vector<pair<int ,int >> envHeights;
1481
- bool yInTrack = (y < elementOffset + elementHeight) ? true : false ;
1482
1482
1483
- int count = CountTrackEnvelopes (track);
1484
1483
for (int i = 0 ; i < count; ++i)
1485
1484
{
1486
1485
TrackEnvelope *env = GetTrackEnvelope (track, i);
1486
+ const int envH = static_cast <int >(GetEnvelopeInfo_Value (env, " I_TCPH" ));
1487
+ if (envH < 1 ) continue ;
1487
1488
1488
- if (GetEnvelopeInfo_Value (env," I_TCPH " ) < 1.0 ) continue ;
1489
- if (GetEnvelopeInfo_Value (env, " I_TCPY " ) < ( elementHeight - spacer) ) continue ; // does not have an envcp
1489
+ const int envY = static_cast < int > (GetEnvelopeInfo_Value (env, " I_TCPY " )) ;
1490
+ if (envY < elementHeight - spacer) continue ; // does not have an envcp
1490
1491
1491
1492
if (yInTrack)
1492
1493
{
1493
1494
if (envelopes)
1494
1495
envelopes->push_back (env);
1495
1496
}
1496
- else
1497
+ else if (y >= envY && y < envY + envH)
1497
1498
{
1498
- const int envHeight = static_cast <int >(GetEnvelopeInfo_Value (env," I_TCPH" ));
1499
- const int envId = i;
1500
- envHeights.push_back (make_pair (envHeight, envId));
1501
- }
1502
- }
1503
-
1504
- if (!yInTrack)
1505
- {
1506
- int envelopeStart = elementOffset + elementHeight;
1507
- for (size_t i = 0 ; i < envHeights.size (); ++i)
1508
- {
1509
- int envelopeEnd = envelopeStart + envHeights[i].first ;
1510
- if (y >= envelopeStart && y < envelopeEnd)
1511
- {
1512
- envelope = GetTrackEnvelope (track, envHeights[i].second );
1513
- elementHeight = envHeights[i].first ;
1514
- elementOffset = envelopeStart;
1515
- break ;
1516
- }
1517
- envelopeStart += envHeights[i].first ;
1499
+ envelope = env;
1500
+ elementOffset = envY;
1501
+ elementHeight = envH;
1502
+ break ;
1518
1503
}
1519
1504
}
1520
1505
}
0 commit comments