Sequencer - Different colors when tracks are hovered
This commit is contained in:
parent
6bae9ca7a4
commit
048cc1c966
1 changed files with 17 additions and 9 deletions
|
@ -391,6 +391,7 @@ struct T_SyncViewImpl_
|
|||
const uint32_t ColMain{ ImGui::GetColorU32( ImVec4{ .4 , .4 , .4 , .8 } ) };
|
||||
const uint32_t ColSelection{ ImGui::GetColorU32( ImVec4{ .8 , 1 , .8 , .2 } ) };
|
||||
const uint32_t ColPointNormal{ ImGui::GetColorU32( ImVec4{ 0 , 0 , 0 , .25 } ) };
|
||||
const uint32_t ColPointHovered{ ImGui::GetColorU32( ImVec4{ 1 , 1 , 1 , .75 } ) };
|
||||
const uint32_t ColPointSelected{ ImGui::GetColorU32( ImVec4{ 0 , 0 , 0 , .75 } ) };
|
||||
const ImVec2 BtSize{ 20 , 0 };
|
||||
|
||||
|
@ -1050,6 +1051,12 @@ void T_SyncViewImpl_::sequencerTrack(
|
|||
if ( !container.Overlaps( bb ) ) {
|
||||
return;
|
||||
}
|
||||
const ImRect bar{
|
||||
ImVec2{ ImFloor( bb.Min.x ) ,
|
||||
ImFloor( ImMax( container.Min.y , bb.Min.y ) ) } ,
|
||||
ImVec2{ ImFloor( bb.Max.x ) - 1 ,
|
||||
ImFloor( ImMin( container.Max.y , bb.Max.y ) ) }
|
||||
};
|
||||
|
||||
// Add track display record
|
||||
const auto dTrackIdx{ dspTracks.size( ) };
|
||||
|
@ -1061,24 +1068,21 @@ void T_SyncViewImpl_::sequencerTrack(
|
|||
|
||||
// Compute colors
|
||||
using namespace ImGui;
|
||||
auto const& mp{ GetIO( ).MousePos };
|
||||
const bool sCurve{ selId && id == *selId };
|
||||
const float scv{ sCurve ? 1.f : .7f };
|
||||
const float scv{ sCurve ? 1.f : ( bar.Contains( mp ) ? .85f : .7f ) };
|
||||
const auto bgColor{ ColorHSVAToU32( hue , .25f , scv , .25f ) } ,
|
||||
borderColor{ ColorHSVAToU32( hue , .5f , scv , 1.f ) };
|
||||
const uint32_t segColors[] = {
|
||||
ColorHSVAToU32( hue - .03f , .4f , .7f , 1.f ) ,
|
||||
ColorHSVAToU32( hue + .03f , .4f , .7f , 1.f ) ,
|
||||
ColorHSVAToU32( hue - .03f , .4f , .85f , 1.f ) ,
|
||||
ColorHSVAToU32( hue + .03f , .4f , .85f , 1.f ) ,
|
||||
ColorHSVAToU32( hue - .03f , .4f , 1.f , 1.f ) ,
|
||||
ColorHSVAToU32( hue + .03f , .4f , 1.f , 1.f ) ,
|
||||
};
|
||||
|
||||
// Draw the bar itself
|
||||
const ImRect bar{
|
||||
ImVec2{ ImFloor( bb.Min.x ) ,
|
||||
ImFloor( ImMax( container.Min.y , bb.Min.y ) ) } ,
|
||||
ImVec2{ ImFloor( bb.Max.x ) - 1 ,
|
||||
ImFloor( ImMin( container.Max.y , bb.Max.y ) ) }
|
||||
};
|
||||
auto* const dl{ GetWindowDrawList( ) };
|
||||
dl->AddRectFilled( bar.Min , bar.Max , bgColor );
|
||||
if ( container.Contains( bb.GetTL( ) ) ) {
|
||||
|
@ -1126,7 +1130,8 @@ void T_SyncViewImpl_::sequencerTrack(
|
|||
|
||||
// Add segment to displayed list
|
||||
const bool sSegment{ sCurve && selSegment && *selSegment == i };
|
||||
const auto color{ segColors[ i % 2 + ( sSegment ? 2 : 0 ) ] };
|
||||
const auto color{ segColors[ i % 2 + ( sSegment ? 4
|
||||
: ( segFull.Contains( mp ) ? 2 : 0 ) ) ] };
|
||||
auto dSegIdx{ dspSegments.size( ) };
|
||||
auto& dSeg{ dspSegments.addNew( ) };
|
||||
dSeg.area = segFull;
|
||||
|
@ -1154,8 +1159,11 @@ void T_SyncViewImpl_::sequencerTrack(
|
|||
ym
|
||||
};
|
||||
const bool sPoint{ sSegment && selPoint && *selPoint == j };
|
||||
const bool hpt{ !sPoint && segFull.Contains( mp )
|
||||
&& ImLengthSqr( mp - ctr ) <= 2.25 * PointRadiusSqr };
|
||||
dl->AddCircleFilled( ctr , PointRadius ,
|
||||
sPoint ? ColPointSelected : ColPointNormal );
|
||||
sPoint ? ColPointSelected
|
||||
: ( hpt ? ColPointHovered : ColPointNormal ) );
|
||||
cDur += j < nd ? seg.durations[ j ] : 0;
|
||||
|
||||
// Add point record
|
||||
|
|
Loading…
Reference in a new issue