Browse Source

Slider fix hovering bounding test excluding padding between outer frame and grab

ocornut 10 years ago
parent
commit
ce8150ce69
1 changed files with 2 additions and 2 deletions
  1. 2 2
      imgui.cpp

+ 2 - 2
imgui.cpp

@@ -4887,13 +4887,13 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
     const ImGuiAabb bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
     const ImGuiAabb bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));
 
 
     // NB- we don't call ItemSize() yet becausae we may turn into a text edit box below
     // NB- we don't call ItemSize() yet becausae we may turn into a text edit box below
-    if (!ItemAdd(slider_bb, &id))
+    if (!ItemAdd(frame_bb, &id))
     {
     {
         ItemSize(bb);
         ItemSize(bb);
         return false;
         return false;
     }
     }
 
 
-    const bool hovered = IsHovered(slider_bb, id);
+    const bool hovered = IsHovered(frame_bb, id);
     if (hovered)
     if (hovered)
         g.HoveredId = id;
         g.HoveredId = id;