diff --git a/profiler/build/win32/Tracy.vcxproj b/profiler/build/win32/Tracy.vcxproj
index d152129d..081735dc 100644
--- a/profiler/build/win32/Tracy.vcxproj
+++ b/profiler/build/win32/Tracy.vcxproj
@@ -136,6 +136,7 @@
+
@@ -269,6 +270,7 @@
+
diff --git a/profiler/build/win32/Tracy.vcxproj.filters b/profiler/build/win32/Tracy.vcxproj.filters
index 7b3e7a32..d1731d98 100644
--- a/profiler/build/win32/Tracy.vcxproj.filters
+++ b/profiler/build/win32/Tracy.vcxproj.filters
@@ -351,6 +351,9 @@
src
+
+ server
+
@@ -713,6 +716,9 @@
src
+
+ server
+
diff --git a/server/TracyTimelineController.cpp b/server/TracyTimelineController.cpp
new file mode 100644
index 00000000..0c1943ff
--- /dev/null
+++ b/server/TracyTimelineController.cpp
@@ -0,0 +1,29 @@
+#include "imgui.h"
+
+#include "TracyTimelineController.hpp"
+
+namespace tracy
+{
+
+TimelineController::TimelineController()
+ : m_height( 0 )
+ , m_offset( 0 )
+ , m_scroll( 0 )
+{
+}
+
+void TimelineController::End( float offset )
+{
+ const auto scrollPos = ImGui::GetScrollY();
+ if( scrollPos == 0 && m_scroll != 0 )
+ {
+ m_height = 0;
+ }
+ else
+ {
+ if( offset > m_height ) m_height = offset;
+ }
+ m_scroll = scrollPos;
+}
+
+}
diff --git a/server/TracyTimelineController.hpp b/server/TracyTimelineController.hpp
new file mode 100644
index 00000000..20c51390
--- /dev/null
+++ b/server/TracyTimelineController.hpp
@@ -0,0 +1,24 @@
+#ifndef __TRACYTIMELINECONTROLLER_HPP__
+#define __TRACYTIMELINECONTROLLER_HPP__
+
+namespace tracy
+{
+
+class TimelineController
+{
+public:
+ TimelineController();
+
+ void End( float offset );
+
+ float GetHeight() const { return m_height; }
+
+private:
+ float m_height;
+ float m_offset;
+ float m_scroll;
+};
+
+}
+
+#endif
diff --git a/server/TracyUserData.cpp b/server/TracyUserData.cpp
index 0bfe6eff..e62fdba9 100644
--- a/server/TracyUserData.cpp
+++ b/server/TracyUserData.cpp
@@ -81,8 +81,10 @@ void UserData::LoadState( ViewData& data )
{
fread( &data.zvStart, 1, sizeof( data.zvStart ), f );
fread( &data.zvEnd, 1, sizeof( data.zvEnd ), f );
- fread( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
- fread( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
+ //fread( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
+ fseek( f, sizeof( float ), SEEK_CUR );
+ //fread( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
+ fseek( f, sizeof( float ), SEEK_CUR );
fread( &data.frameScale, 1, sizeof( data.frameScale ), f );
fread( &data.frameStart, 1, sizeof( data.frameStart ), f );
}
@@ -128,8 +130,11 @@ void UserData::SaveState( const ViewData& data )
fwrite( &ver, 1, sizeof( ver ), f );
fwrite( &data.zvStart, 1, sizeof( data.zvStart ), f );
fwrite( &data.zvEnd, 1, sizeof( data.zvEnd ), f );
- fwrite( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
- fwrite( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
+ //fwrite( &data.zvHeight, 1, sizeof( data.zvHeight ), f );
+ float zero = 0;
+ fwrite( &zero, 1, sizeof( zero ), f );
+ //fwrite( &data.zvScroll, 1, sizeof( data.zvScroll ), f );
+ fwrite( &zero, 1, sizeof( zero ), f );
fwrite( &data.frameScale, 1, sizeof( data.frameScale ), f );
fwrite( &data.frameStart, 1, sizeof( data.frameStart ), f );
fclose( f );
diff --git a/server/TracyView.hpp b/server/TracyView.hpp
index 3604786b..7fd57439 100644
--- a/server/TracyView.hpp
+++ b/server/TracyView.hpp
@@ -16,6 +16,7 @@
#include "TracyFileWrite.hpp"
#include "TracyShortPtr.hpp"
#include "TracySourceContents.hpp"
+#include "TracyTimelineController.hpp"
#include "TracyUserData.hpp"
#include "TracyVector.hpp"
#include "TracyViewData.hpp"
@@ -402,6 +403,7 @@ private:
uint64_t m_totalMemory;
ViewData m_vd;
+ TimelineController m_tc;
const ZoneEvent* m_zoneInfoWindow = nullptr;
const ZoneEvent* m_zoneHighlight;
diff --git a/server/TracyViewData.hpp b/server/TracyViewData.hpp
index 760e5f0a..ba5d9331 100644
--- a/server/TracyViewData.hpp
+++ b/server/TracyViewData.hpp
@@ -35,8 +35,6 @@ struct ViewData
{
int64_t zvStart = 0;
int64_t zvEnd = 0;
- int32_t zvHeight = 0;
- int32_t zvScroll = 0;
int32_t frameScale = 0;
int32_t frameStart = 0;
diff --git a/server/TracyView_Timeline.cpp b/server/TracyView_Timeline.cpp
index 83693f62..c39195b3 100644
--- a/server/TracyView_Timeline.cpp
+++ b/server/TracyView_Timeline.cpp
@@ -285,7 +285,7 @@ void View::DrawTimeline()
const auto wpos = ImGui::GetCursorScreenPos();
const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
- const auto h = std::max( m_vd.zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value
+ const auto h = std::max( m_tc.GetHeight(), ImGui::GetContentRegionAvail().y - 4 ); // magic border value
ImGui::ItemSize( ImVec2( w, h ) );
bool hover = ImGui::IsWindowHovered() && ImGui::IsMouseHoveringRect( wpos, wpos + ImVec2( w, h ) );
@@ -976,17 +976,7 @@ void View::DrawTimeline()
offset = DrawPlots( offset, pxns, wpos, hover, yMin, yMax );
}
- const auto scrollPos = ImGui::GetScrollY();
- if( scrollPos == 0 && m_vd.zvScroll != 0 )
- {
- m_vd.zvHeight = 0;
- }
- else
- {
- if( offset > m_vd.zvHeight ) m_vd.zvHeight = offset;
- }
- m_vd.zvScroll = scrollPos;
-
+ m_tc.End( offset );
ImGui::EndChild();
for( auto& ann : m_annotations )