impr: Allow sidebar to be only resized from the right
This commit is contained in:
parent
e8b391c0f6
commit
b3d208e6e6
@ -159,6 +159,8 @@ namespace ImGuiExt {
|
||||
|
||||
void OpenPopupInWindow(const char *window_name, const char *popup_name);
|
||||
|
||||
void DisableWindowResize(ImGuiDir dir);
|
||||
|
||||
struct ImHexCustomData {
|
||||
ImVec4 Colors[ImGuiCustomCol_COUNT];
|
||||
|
||||
|
@ -743,6 +743,17 @@ namespace ImGuiExt {
|
||||
End();
|
||||
}
|
||||
|
||||
void DisableWindowResize(ImGuiDir dir) {
|
||||
const auto window = GetCurrentWindow();
|
||||
const auto borderId = GetWindowResizeBorderID(window, dir);
|
||||
if (borderId == GetHoveredID()) {
|
||||
GImGui->ActiveIdMouseButton = 0;
|
||||
SetHoveredID(0);
|
||||
}
|
||||
if (borderId == GetActiveID())
|
||||
SetActiveID(0, window);
|
||||
}
|
||||
|
||||
|
||||
bool TitleBarButton(const char *label, ImVec2 size_arg) {
|
||||
ImGuiWindow *window = GetCurrentWindow();
|
||||
|
@ -125,7 +125,6 @@ namespace hex::plugin::builtin {
|
||||
|
||||
bool open = static_cast<u32>(openWindow) == index;
|
||||
if (open) {
|
||||
|
||||
ImGui::SetNextWindowPos(ImGui::GetWindowPos() + sidebarPos + ImVec2(sidebarWidth - 1_scaled, -1_scaled));
|
||||
ImGui::SetNextWindowSizeConstraints(ImVec2(0, dockSpaceSize.y + 5_scaled), ImVec2(FLT_MAX, dockSpaceSize.y + 5_scaled));
|
||||
|
||||
@ -140,6 +139,11 @@ namespace hex::plugin::builtin {
|
||||
if (!ImGui::IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows) && !sideBarFocused) {
|
||||
openWindow = -1;
|
||||
}
|
||||
|
||||
ImGuiExt::DisableWindowResize(ImGuiDir_Up);
|
||||
ImGuiExt::DisableWindowResize(ImGuiDir_Down);
|
||||
ImGuiExt::DisableWindowResize(ImGuiDir_Left);
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar();
|
||||
|
Loading…
x
Reference in New Issue
Block a user