瀏覽代碼

REVIEWED: `GuiTabBar()` detect middle button press over tab

Ray 1 年之前
父節點
當前提交
498511e4cf
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/raygui.h

+ 3 - 0
src/raygui.h

@@ -1743,6 +1743,9 @@ int GuiTabBar(Rectangle bounds, const char **text, int count, int *active)
                 if (toggle) *active = i;
             }
 
+            // Close tab with middle mouse button pressed
+            if (CheckCollisionPointRec(GetMousePosition(), tabBounds) && IsMouseButtonPressed(MOUSE_MIDDLE_BUTTON)) result = i;
+
             GuiSetStyle(TOGGLE, TEXT_PADDING, textPadding);
             GuiSetStyle(TOGGLE, TEXT_ALIGNMENT, textAlignment);