command palette: (breaking) attempt to center the window
This commit is contained in:
parent
e454433199
commit
60de8b0e90
|
@ -51,7 +51,9 @@ void FurnaceGUI::drawPalette() {
|
||||||
if (paletteFirstFrame)
|
if (paletteFirstFrame)
|
||||||
ImGui::SetKeyboardFocusHere();
|
ImGui::SetKeyboardFocusHere();
|
||||||
|
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
int width=ImGui::GetContentRegionAvail().x;
|
||||||
|
|
||||||
|
ImGui::SetNextItemWidth(width);
|
||||||
|
|
||||||
if (ImGui::InputTextWithHint("##CommandPaletteSearch","Search...",&paletteQuery) || paletteFirstFrame) {
|
if (ImGui::InputTextWithHint("##CommandPaletteSearch","Search...",&paletteQuery) || paletteFirstFrame) {
|
||||||
paletteSearchResults.clear();
|
paletteSearchResults.clear();
|
||||||
|
@ -81,7 +83,7 @@ void FurnaceGUI::drawPalette() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginChild("CommandPaletteList",ImVec2(312,216),false,0)) {
|
if (ImGui::BeginChild("CommandPaletteList",ImVec2(width,canvasH*0.3),false,0)) {
|
||||||
bool navigated=false;
|
bool navigated=false;
|
||||||
if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) && curPaletteChoice>0) {
|
if (ImGui::IsKeyPressed(ImGuiKey_UpArrow) && curPaletteChoice>0) {
|
||||||
curPaletteChoice-=1;
|
curPaletteChoice-=1;
|
||||||
|
|
|
@ -5137,6 +5137,9 @@ bool FurnaceGUI::loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopup("Command Palette",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
|
if (ImGui::BeginPopup("Command Palette",ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoSavedSettings)) {
|
||||||
|
ImVec2 wsize=ImVec2(canvasW*0.8,canvasH*0.4);
|
||||||
|
ImGui::SetWindowSize(wsize,ImGuiCond_Always);
|
||||||
|
ImGui::SetWindowPos(ImVec2((canvasW-wsize.x)*0.5,100*dpiScale));
|
||||||
drawPalette();
|
drawPalette();
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue