command palette: now a modal + proper sizing¢ering
This commit is contained in:
parent
60de8b0e90
commit
b19f7cfdd8
|
@ -52,7 +52,6 @@ void FurnaceGUI::drawPalette() {
|
|||
ImGui::SetKeyboardFocusHere();
|
||||
|
||||
int width=ImGui::GetContentRegionAvail().x;
|
||||
|
||||
ImGui::SetNextItemWidth(width);
|
||||
|
||||
if (ImGui::InputTextWithHint("##CommandPaletteSearch","Search...",&paletteQuery) || paletteFirstFrame) {
|
||||
|
@ -83,7 +82,10 @@ void FurnaceGUI::drawPalette() {
|
|||
};
|
||||
}
|
||||
|
||||
if (ImGui::BeginChild("CommandPaletteList",ImVec2(width,canvasH*0.3),false,0)) {
|
||||
ImVec2 avail=ImGui::GetContentRegionAvail();
|
||||
avail.y-=ImGui::GetFrameHeightWithSpacing();
|
||||
|
||||
if (ImGui::BeginChild("CommandPaletteList",avail,false,0)) {
|
||||
bool navigated=false;
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) && curPaletteChoice>0) {
|
||||
curPaletteChoice-=1;
|
||||
|
|
|
@ -5136,10 +5136,10 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::BeginPopup("Command Palette",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
|
||||
ImVec2 wsize=ImVec2(canvasW*0.8,canvasH*0.4);
|
||||
if (ImGui::BeginPopupModal("Command Palette",NULL,ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoSavedSettings)) {
|
||||
ImVec2 wsize=ImVec2(canvasW*0.9,canvasH*0.4);
|
||||
ImGui::SetWindowPos(ImVec2((canvasW-wsize.x)*0.5,50*dpiScale));
|
||||
ImGui::SetWindowSize(wsize,ImGuiCond_Always);
|
||||
ImGui::SetWindowPos(ImVec2((canvasW-wsize.x)*0.5,100*dpiScale));
|
||||
drawPalette();
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue