Enable playback frame change with mouse wheel.

This commit is contained in:
Bartosz Taudul 2021-11-15 02:34:13 +01:00
parent 176bc279f1
commit 1002e949d6
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -15509,7 +15509,25 @@ void View::DrawPlayback()
}
}
int tmp = m_playback.frame + 1;
if( ImGui::SliderInt( "Frame image", &tmp, 1, ficnt, "%d" ) )
bool changed = ImGui::SliderInt( "Frame image", &tmp, 1, ficnt, "%d" );
ImGui::SetItemUsingMouseWheel();
if( ImGui::IsItemHovered() )
{
const auto wheel = ImGui::GetIO().MouseWheel;
if( wheel )
{
if( ImGui::IsItemActive() )
{
ImGui::ClearActiveID();
}
else
{
tmp -= (int)wheel;
changed = true;
}
}
}
if( changed )
{
if( tmp < 1 ) tmp = 1;
else if( (uint32_t)tmp > ficnt ) tmp = ficnt;