1
0
mirror of synced 2024-11-30 18:34:29 +01:00

Fix window resizing

This commit is contained in:
WerWolv 2020-11-12 23:08:31 +01:00
parent 86fdd531da
commit f0fe3a85d2
2 changed files with 5 additions and 4 deletions

View File

@ -184,7 +184,7 @@ struct MemoryEditor
CalcSizes(s, mem_size, base_display_addr); CalcSizes(s, mem_size, base_display_addr);
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(s.WindowWidth, FLT_MAX)); ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, 0.0f), ImVec2(s.WindowWidth, FLT_MAX));
if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar)) if (ImGui::Begin(title, &Open, ImGuiWindowFlags_NoScrollbar))
{ {
if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) && ImGui::IsMouseReleased(ImGuiMouseButton_Right)) if (ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows) && ImGui::IsMouseReleased(ImGuiMouseButton_Right))
ImGui::OpenPopup("context"); ImGui::OpenPopup("context");
@ -213,7 +213,10 @@ struct MemoryEditor
if (mem_size == 0x00) { if (mem_size == 0x00) {
constexpr const char *noDataString = "No data loaded!"; constexpr const char *noDataString = "No data loaded!";
draw_list->AddText(ImVec2(ImGui::GetWindowWidth() / 2 - 55, ImGui::GetWindowHeight() / 2), 0xFFFFFFFF, noDataString);
auto pos = ImGui::GetCursorScreenPos();
pos.x += (ImGui::GetWindowWidth() - (ImGui::CalcTextSize(noDataString).x)) / 2;
draw_list->AddText(pos, 0xFFFFFFFF, noDataString);
return; return;
} }

View File

@ -29,7 +29,6 @@ namespace hex {
this->frameBegin(); this->frameBegin();
for (auto &view : this->m_views) { for (auto &view : this->m_views) {
ImGui::SetNextWindowSize(ImVec2(250, 250));
view->createView(); view->createView();
} }
@ -52,7 +51,6 @@ namespace hex {
ImGui::SetNextWindowViewport(viewport->ID); ImGui::SetNextWindowViewport(viewport->ID);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
windowFlags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
windowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; windowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
ImGui::Begin("DockSpace", nullptr, windowFlags); ImGui::Begin("DockSpace", nullptr, windowFlags);