feat: make page buttons always visible
This commit is contained in:
parent
b7bf72d4d1
commit
44375fca25
|
@ -82,34 +82,10 @@ internal class QuestionsTab {
|
|||
private void DrawInactive() {
|
||||
ImGuiHelpers.CenteredText("Inactive questions");
|
||||
|
||||
using var endChild = new OnDispose(ImGui.EndChild);
|
||||
if (!ImGui.BeginChild("ev-inactive-questions", ImGui.GetContentRegionAvail(), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.PushTextWrapPos();
|
||||
using var pop = new OnDispose(ImGui.PopTextWrapPos);
|
||||
|
||||
var loading = this.Plugin.Manager.Loading;
|
||||
|
||||
if (loading) {
|
||||
ImGui.TextUnformatted("Loading...");
|
||||
ImGui.Spacing();
|
||||
} else {
|
||||
foreach (var question in this.Plugin.Manager) {
|
||||
if (question.Active || question is not FullQuestion full) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(full.Text);
|
||||
full.DrawResponses();
|
||||
this.DrawMoreDetailsButton(full);
|
||||
|
||||
ImGui.Spacing();
|
||||
}
|
||||
}
|
||||
|
||||
var dummyHeight = 0f;
|
||||
float pageButtonsWidth;
|
||||
var pageLabel = $"{this.Plugin.Manager.Page:N0}";
|
||||
|
||||
ImGui.PushFont(UiBuilder.IconFont);
|
||||
using (new OnDispose(ImGui.PopFont)) {
|
||||
var prev = ImGuiHelpers.GetButtonSize(FontAwesomeIcon.ArrowLeft.ToIconString());
|
||||
|
@ -119,13 +95,43 @@ internal class QuestionsTab {
|
|||
var heightLeft = ImGui.GetContentRegionAvail().Y;
|
||||
if (heightLeft > 0) {
|
||||
heightLeft -= Math.Max(prev.Y, next.Y);
|
||||
ImGui.Dummy(new Vector2(1, heightLeft));
|
||||
heightLeft -= ImGui.GetStyle().ItemSpacing.Y;
|
||||
dummyHeight = heightLeft;
|
||||
}
|
||||
|
||||
var width = prev.X + label.X + next.X + ImGui.GetStyle().ItemSpacing.X * 2;
|
||||
ImGuiHelpers.CenterCursorFor(width);
|
||||
pageButtonsWidth = prev.X + label.X + next.X + ImGui.GetStyle().ItemSpacing.X * 2;
|
||||
}
|
||||
|
||||
var loading = this.Plugin.Manager.Loading;
|
||||
|
||||
using (new OnDispose(ImGui.EndChild)) {
|
||||
if (!ImGui.BeginChild("ev-inactive-questions", ImGui.GetContentRegionAvail() - new Vector2(0, dummyHeight), false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImGui.PushTextWrapPos();
|
||||
using var pop = new OnDispose(ImGui.PopTextWrapPos);
|
||||
|
||||
if (loading) {
|
||||
ImGui.TextUnformatted("Loading...");
|
||||
ImGui.Spacing();
|
||||
} else {
|
||||
foreach (var question in this.Plugin.Manager) {
|
||||
if (question.Active || question is not FullQuestion full) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ImGui.TextUnformatted(full.Text);
|
||||
full.DrawResponses();
|
||||
this.DrawMoreDetailsButton(full);
|
||||
|
||||
ImGui.Spacing();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGuiHelpers.CenterCursorFor(pageButtonsWidth);
|
||||
|
||||
using (ImGuiHelper.WithDisabled(loading || this.Plugin.Manager.Page == 1)) {
|
||||
if (ImGuiHelper.IconButton(FontAwesomeIcon.ArrowLeft)) {
|
||||
this.Plugin.Manager.Page -= 1;
|
||||
|
|
Loading…
Reference in New Issue