Merge luaML.love
This commit is contained in:
commit
ac305b8e6c
6
0019-B
6
0019-B
|
@ -1,4 +1,4 @@
|
|||
B = function(preserve_screen_top_of_cursor_node)
|
||||
B = function()
|
||||
-- print('B')
|
||||
-- recompute various aspects based on the current viewport settings
|
||||
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font so update it
|
||||
|
@ -18,10 +18,10 @@ B = function(preserve_screen_top_of_cursor_node)
|
|||
obj.zdata = love.math.newBezierCurve(zdata):render()
|
||||
elseif obj.type == 'text' then
|
||||
if obj.w then
|
||||
update_editor_box(obj, preserve_screen_top_of_cursor_node)
|
||||
update_editor_box(obj)
|
||||
else
|
||||
obj.text = love.graphics.newText(love.graphics.getFont(), obj.data)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
compute_layout = function(node, x,y, nodes_to_render, preserve_screen_top_of_cursor_node)
|
||||
compute_layout = function(node, x,y, nodes_to_render)
|
||||
-- append to nodes_to_render flattened instructions to render a hierarchy of nodes
|
||||
-- return x,y rendered until (surface coordinates)
|
||||
if node.type == 'text' then
|
||||
|
@ -31,7 +31,7 @@ compute_layout = function(node, x,y, nodes_to_render, preserve_screen_top_of_cur
|
|||
if node.editor == nil then
|
||||
initialize_editor(node)
|
||||
else
|
||||
update_editor_box(node, preserve_screen_top_of_cursor_node)
|
||||
update_editor_box(node)
|
||||
end
|
||||
node.h = box_height(node)
|
||||
table.insert(nodes_to_render, node)
|
||||
|
|
|
@ -12,6 +12,6 @@ on.text_input = function(t)
|
|||
local definition_name = live.get_definition_name_from_buffer(live.definition_to_string(Cursor_node.editor))
|
||||
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
|
||||
Cursor_node.bg = definition_background_color(definition_name)
|
||||
B(--[[preserve screen_top of cursor node]] true)
|
||||
B()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,9 +54,9 @@ on.keychord_press = function(chord, key)
|
|||
local definition_name = live.get_definition_name_from_buffer(live.definition_to_string(Cursor_node.editor))
|
||||
maybe_update_key_in_definitions(old_definition_name, definition_name, Cursor_node)
|
||||
if chord == 'return' then
|
||||
A(--[[preserve screen_top of cursor node]] true)
|
||||
A()
|
||||
else
|
||||
B(--[[preserve screen_top of cursor node]] true)
|
||||
B()
|
||||
end
|
||||
end
|
||||
else
|
||||
|
@ -92,4 +92,4 @@ on.keychord_press = function(chord, key)
|
|||
B()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
8
0028-A
8
0028-A
|
@ -1,13 +1,13 @@
|
|||
A = function(preserve_screen_top_of_cursor_node)
|
||||
A = function()
|
||||
-- print('A')
|
||||
love.graphics.setFont(love.graphics.newFont(scale(20))) -- editor objects implicitly depend on current font
|
||||
-- translate Definitions to Surface
|
||||
Surface = {}
|
||||
for key,node in pairs(Definitions) do
|
||||
node.key = key
|
||||
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
|
||||
compute_layout(node, node.x,node.y, Surface)
|
||||
end
|
||||
-- continue the pipeline
|
||||
B(preserve_screen_top_of_cursor_node)
|
||||
B()
|
||||
-- TODO: ugly that we're manipulating editor objects twice
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
update_editor_box = function(node, preserve_screen_top_of_cursor_node)
|
||||
update_editor_box = function(node)
|
||||
if node.editor == nil then return end
|
||||
-- Compute screen_top1 in viewport coordinates because the editor's font takes scaling into account.
|
||||
if vy(node.y) > 0 then
|
||||
if not preserve_screen_top_of_cursor_node or node ~= Cursor_node then
|
||||
if node ~= Cursor_node then
|
||||
node.editor.screen_top1.line = 1
|
||||
node.editor.screen_top1.pos = 1
|
||||
end
|
||||
|
|
8
0107-A1
8
0107-A1
|
@ -1,4 +1,4 @@
|
|||
A1 = function(key, preserve_screen_top_of_cursor_node)
|
||||
A1 = function(key)
|
||||
-- like A, but updating a single node
|
||||
-- this only works because Nodes is a flat array; we don't support row/col types here yet
|
||||
-- delete previously added shapes for this node:
|
||||
|
@ -9,7 +9,7 @@ A1 = function(key, preserve_screen_top_of_cursor_node)
|
|||
end
|
||||
end
|
||||
local node = Definitions[key]
|
||||
compute_layout(node, node.x,node.y, Surface, preserve_screen_top_of_cursor_node)
|
||||
compute_layout(node, node.x,node.y, Surface)
|
||||
-- continue the pipeline
|
||||
B(preserve_screen_top_of_cursor_node)
|
||||
end
|
||||
B()
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue