Proper way to detect mouse hover over timeline.

This commit is contained in:
Bartosz Taudul 2022-08-14 17:17:51 +02:00
parent 86c2574848
commit 77e39700b1
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -287,8 +287,8 @@ void View::DrawTimeline()
const auto dpos = wpos + ImVec2( 0.5f, 0.5f ); const auto dpos = wpos + ImVec2( 0.5f, 0.5f );
const auto h = std::max<float>( m_vd.zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value const auto h = std::max<float>( m_vd.zvHeight, ImGui::GetContentRegionAvail().y - 4 ); // magic border value
ImGui::InvisibleButton( "##zones", ImVec2( w, h ) ); ImGui::ItemSize( ImVec2( w, h ) );
bool hover = ImGui::IsItemHovered(); bool hover = ImGui::IsWindowHovered() && ImGui::IsMouseHoveringRect( wpos, wpos + ImVec2( w, h ) );
draw = ImGui::GetWindowDrawList(); draw = ImGui::GetWindowDrawList();
const auto nspx = 1.0 / pxns; const auto nspx = 1.0 / pxns;