1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

React to enter key in "go to frame" dialog.

This commit is contained in:
Bartosz Taudul 2019-08-17 22:01:06 +02:00
parent 258cf38d64
commit 1024992493

View File

@ -10024,14 +10024,16 @@ void View::DrawGoToFrame()
const auto numFrames = mainFrameSet ? m_frames->frames.size() - 1 : m_frames->frames.size();
const auto frameOffset = mainFrameSet ? 0 : 1;
bool goClicked = false;
ImGui::Begin( "Go to frame", &m_goToFrame, ImGuiWindowFlags_AlwaysAutoResize );
ImGui::InputInt( "Frame", &frameNum );
goClicked |= ImGui::InputInt( "Frame", &frameNum, 1, 100, ImGuiInputTextFlags_EnterReturnsTrue );
frameNum = std::min( std::max( frameNum, 1 ), int( numFrames ) );
#ifdef TRACY_EXTENDED_FONT
if( ImGui::Button( ICON_FA_CROSSHAIRS " Go to" ) )
goClicked |= ImGui::Button( ICON_FA_CROSSHAIRS " Go to" );
#else
if( ImGui::Button( "Go to" ) )
goClicked |= ImGui::Button( "Go to" );
#endif
if( goClicked )
{
ZoomToRange( m_worker.GetFrameBegin( *m_frames, frameNum - frameOffset ), m_worker.GetFrameEnd( *m_frames, frameNum - frameOffset ) );
}