pad out overflow buttons to prevent fat fingering

akkartik
Nov 17, 2024, 1:00 AM
GO2QWWUIJZDJXLJ4O4MBYULDGNCQ5SYJP3ORNLZ4VFSY4BSRXWKAC

Dependencies

  • [2] AZMYKWMH resolve conflicts
  • [3] I2YECDRF decouple menu font from output buffer
  • [4] Q3EQI5LI some keyboard shortcuts on non-mobile devices
  • [5] SIJ5I4NZ extract a helper for buttons
  • [6] W4EQ6IW4 simplify state management for menus
  • [7] JV27LDDK sliders for font size and color settings
  • [8] W3RRTO4P extract a second helper for buttons
  • [9] 5RUFNRJO start of the visual skeleton
  • [*] R5QXEHUI somebody stop me
  • [*] 5MEJ7XNH lay out buttons based on device dimensions
  • [*] PRE6XPRN responsively increase/decrease font height

Change contents

  • file addition: 0186-find_overflow_button (----------)
    [11.2]
    find_overflow_button = function()
    if Overflow_button == nil then return end
    for i,button in ipairs(Global_state.button_handlers) do
    if button == Overflow_button then
    local max_width = 0
    for j=i+1, #Global_state.button_handlers do
    local b = Global_state.button_handlers[j]
    max_width = math.max(max_width, b.w)
    end
    return i, max_width
    end
    end
    end
  • file addition: 0185-redraw_overflow_buttons (----------)
    [11.2]
    redraw_overflow_buttons = function(y)
    if Show_menu ~= 'overflow' then return end
    local bottom = y + 10
    App.color(Menu_background)
    local overflow_button_index, overflow_width = find_overflow_button()
    if overflow_button_index == nil then
    error('overflow button not found')
    end
    love.graphics.rectangle('fill', Overflow_button.x-5, Menu_bottom, overflow_width+10, bottom - Menu_bottom)
    for j=overflow_button_index+1, #Global_state.button_handlers do
    local b = Global_state.button_handlers[j]
    b.icon(b)
    end
    end
  • replacement in 0118-overflowable_button at line 11
    [3.280][3.280:290]()
    y = y2
    [3.280]
    [3.290]
    y = y2 + 10
  • edit in 0021-draw_menu at line 46
    [12.4930]
    [13.1344]
    -- done computing all menu buttons; now redraw them with a background under them
    redraw_overflow_buttons(y)
  • replacement in 0021-draw_menu at line 58
    [3.5795][2.1637:1641]()
    end
    [3.5795]
    end