@@ -42,6 +42,7 @@ import com.lambda.util.WindowUtils.setLambdaWindowIcon
4242import imgui.ImGui
4343import imgui.extension.implot.ImPlot
4444import imgui.flag.ImGuiCol
45+ import imgui.flag.ImGuiCond
4546import imgui.flag.ImGuiHoveredFlags
4647import imgui.flag.ImGuiWindowFlags
4748import net.minecraft.SharedConstants
@@ -58,6 +59,8 @@ object ClickGuiLayout : Loadable, Configurable(GuiConfig) {
5859 var open = false
5960 var developerMode = false
6061 val keybind by setting(" Keybind" , KeyCode .Y )
62+ private var initialLayoutComplete = false
63+ private var frameCount = 0
6164
6265 private enum class Group (override val displayName : String ) : NamedEnum {
6366 General (" General" ),
@@ -214,11 +217,9 @@ object ClickGuiLayout : Loadable, Configurable(GuiConfig) {
214217 val baseY = MenuBar .height + 10f
215218
216219 tags.forEach { tag ->
217- // FixMe:
218- // Ok so, ImGui has many different conditions and after having tried for multiple hours
219- // I could not get either ImGuiCond.Appearing or ImGuiCond.FirstEverUse to work correctly
220- // for this use case so for the time being we will leave the positions fixed. Too bad!
221- ImGui .setNextWindowPos(nextX, baseY)
220+ if (frameCount >= 1 ) {
221+ ImGui .setNextWindowPos(nextX, baseY, ImGuiCond .FirstUseEver )
222+ }
222223
223224 // FixMe:
224225 // Due to the auto resize of windows, if a tag has no module names that is at least the
@@ -230,10 +231,14 @@ object ClickGuiLayout : Loadable, Configurable(GuiConfig) {
230231 .filter { it.tag == tag }
231232 .forEach { with (ModuleEntry (it)) { buildLayout() } }
232233
233- nextX + = windowContentRegionMaxX + 20f // hard coded offset, need to find a get to get the outer position of the window
234+ nextX + = ImGui .getWindowWidth() + 20f
234235 }
235236 }
236237
238+ if (frameCount++ == 1 ) {
239+ initialLayoutComplete = true
240+ }
241+
237242 renderQuickSearch()
238243
239244 if (developerMode) {
@@ -269,6 +274,8 @@ object ClickGuiLayout : Loadable, Configurable(GuiConfig) {
269274 LambdaSound .ModuleOn .play()
270275 mc.setScreen(LambdaScreen )
271276 open = true
277+ frameCount = 0
278+ initialLayoutComplete = false
272279 }
273280 }
274281 }
0 commit comments