responsively increase/decrease font height
Only using hotkeys for now, which are only available on non-mobile devices, and not very discoverable. But this is an accessibility foundation.
This commit is contained in:
parent
1f272c9d39
commit
e03d3ea172
|
@ -8,7 +8,7 @@ on.initialize = function()
|
|||
Editor_state = edit.initialize_state(
|
||||
Menu_bottom + 20, -- top
|
||||
Safe_height/2-5, -- bottom
|
||||
100, -- left
|
||||
Menu_left + 50 + Line_number_padding, -- left
|
||||
math.min(100+30*App.width('m'), Safe_width*2/3), -- right
|
||||
love.graphics.getFont():getHeight(), Line_height)
|
||||
Text.redraw_all(Editor_state)
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
on.keychord_press = function(chord, key)
|
||||
edit.keychord_press(Editor_state, chord, key)
|
||||
if chord == 'C-=' then
|
||||
update_font_settings(Editor_state.font_height+2)
|
||||
elseif chord == 'C--' then
|
||||
update_font_settings(Editor_state.font_height-2)
|
||||
elseif chord == 'C-0' then
|
||||
update_font_settings(20)
|
||||
else
|
||||
edit.keychord_press(Editor_state, chord, key)
|
||||
end
|
||||
end
|
|
@ -2,5 +2,6 @@ on.resize = function()
|
|||
_, _, Safe_width, Safe_height = love.window.getSafeArea()
|
||||
Editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
|
||||
Editor_state.width = Editor_state.right - Editor_state.left
|
||||
Editor_state.bottom = Safe_height/2-5
|
||||
Text.redraw_all(Editor_state)
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
update_font_settings = function(font_height)
|
||||
love.graphics.setFont(love.graphics.newFont(font_height))
|
||||
Line_height = math.floor(love.graphics.getFont():getHeight()*1.3)
|
||||
Line_number_padding = Line_number_width*App.width('m')
|
||||
Menu_height = 5 + Line_height + 5
|
||||
Menu_bottom = Menu_top + Menu_height
|
||||
Editor_state.top = Menu_bottom + 20
|
||||
Editor_state.left = Menu_left + 50 + Line_number_padding
|
||||
Editor_state.right = math.min(100+30*App.width('m'), Safe_width*2/3)
|
||||
Editor_state.width = Editor_state.right - Editor_state.left
|
||||
edit.update_font_settings(Editor_state, font_height)
|
||||
Text.redraw_all(Editor_state)
|
||||
end
|
Loading…
Reference in New Issue