Skip to content

Commit

Permalink
- fixed clicky removal X button
Browse files Browse the repository at this point in the history
  • Loading branch information
DerpleMQ2 committed Feb 23, 2024
1 parent 18c51f4 commit c0d1d6a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions utils/rgmercs_utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3445,35 +3445,36 @@ function Utils.RenderSettingsTable(settings, settingNames, defaults, category)
ImGui.TableNextColumn()
ImGui.Text((defaults[k].DisplayName or "None"))
ImGui.TableNextColumn()
ImGui.PushID(k .. "__btn")
ImGui.PushFont(ImGui.ConsoleFont)
local displayCharCount = 11
local nameLen = settings[k]:len()
local maxStart = (nameLen - displayCharCount) + 1
local startDisp = (os.clock() % maxStart) + 1

ImGui.PushID(k .. "__btn")
if ImGui.SmallButton(nameLen > 0 and settings[k]:sub(startDisp, (startDisp + displayCharCount - 1)) or "[Drop Here]") then
if mq.TLO.Cursor() then
settings[k] = mq.TLO.Cursor.Name()
pressed = true
end
end
ImGui.PopID()

ImGui.PopFont()
if nameLen > 0 then
Utils.Tooltip(settings[k])
end
ImGui.SameLine()
ImGui.PushID(k .. "__clear_btn")
if ImGui.SmallButton(ICONS.MD_CLEAR) then
if mq.TLO.Cursor() then
settings[k] = ""
pressed = true
end
settings[k] = ""
pressed = true
end
ImGui.PopID()
Utils.Tooltip(string.format("Drop a new item here to replace\n%s", settings[k]))
new_loadout = new_loadout or
((pressed or false) and (defaults[k].RequiresLoadoutChange or false))
any_pressed = any_pressed or (pressed or false)
ImGui.PopID()
elseif defaults[k].Type ~= "Custom" then
ImGui.TableNextColumn()
ImGui.Text((defaults[k].DisplayName or "None"))
Expand Down

0 comments on commit c0d1d6a

Please sign in to comment.