resize handler

This commit is contained in:
Kartik K. Agaram 2023-11-15 07:37:36 -08:00
parent 28f1e113a4
commit d6abaaa582
4 changed files with 13 additions and 3 deletions

View File

@ -2,12 +2,14 @@ on.initialize = function()
love.graphics.setFont(love.graphics.newFont(20))
Line_height = math.floor(love.graphics.getFont():getHeight()*1.3)
Line_number_padding = Line_number_width*App.width('m')
Menu_left, Menu_top = love.window.getSafeArea()
Menu_left, Menu_top, Safe_width, Safe_height = love.window.getSafeArea()
Menu_height = 5 + Line_height + 5
Menu_bottom = Menu_top + Menu_height
Editor_state = edit.initialize_state(
--[[top]] Menu_bottom + 20, --[[bottom]] App.screen.height/2-5,
--[[left]] 100, --[[right]] 400,
Menu_bottom + 20, -- top
Safe_height/2-5, -- bottom
100, -- left
math.min(100+30*App.width('m'), Safe_width*2/3), -- right
love.graphics.getFont():getHeight(), Line_height)
Text.redraw_all(Editor_state)
end

1
0029-Safe_width Normal file
View File

@ -0,0 +1 @@
Safe_width = 0

1
0030-Safe_height Normal file
View File

@ -0,0 +1 @@
Safe_height = 0

6
0031-on.resize Normal file
View File

@ -0,0 +1,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
Text.redraw_all(Editor_state)
end