backport a few more changes from driver.love
None of these should affect behavior.
This commit is contained in:
parent
0e3f1f7732
commit
c3de51769c
7
0002-vx
7
0002-vx
|
@ -1,3 +1,4 @@
|
|||
vx = function(x)
|
||||
return scale(x-Viewport.x)
|
||||
end
|
||||
vx = function(sx)
|
||||
-- turn surface coordinates into viewport coordinates
|
||||
return scale(sx-Viewport.x)
|
||||
end
|
||||
|
|
7
0004-vy
7
0004-vy
|
@ -1,3 +1,4 @@
|
|||
vy = function(y)
|
||||
return scale(y-Viewport.y)
|
||||
end
|
||||
vy = function(sy)
|
||||
-- turn surface coordinates into viewport coordinates
|
||||
return scale(sy-Viewport.y)
|
||||
end
|
||||
|
|
|
@ -5,9 +5,11 @@ on.mouse_press = function(x,y, mouse_button)
|
|||
end
|
||||
local node = to_text(x,y)
|
||||
if node then
|
||||
-- position cursor in node
|
||||
Cursor_node = node
|
||||
edit.mouse_press(node.editor, x,y, mouse_button)
|
||||
else
|
||||
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
|
||||
return
|
||||
end
|
||||
-- pan surface
|
||||
Pan = {x=Viewport.x+x/Viewport.zoom,y=Viewport.y+y/Viewport.zoom}
|
||||
end
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
box_height = function(node)
|
||||
-- return the height of a node. The result is scaled.
|
||||
local y = 0
|
||||
for i=1,#node.editor.lines do
|
||||
local line = node.editor.lines[i]
|
||||
if node.editor.line_cache[i] == nil then
|
||||
node.editor.line_cache[i] = {}
|
||||
end
|
||||
node.editor.line_cache[i].fragments = nil
|
||||
node.editor.line_cache[i].screen_line_starting_pos = nil
|
||||
Text.populate_screen_line_starting_pos(node.editor, i)
|
||||
y = y + node.editor.line_height*#node.editor.line_cache[i].screen_line_starting_pos
|
||||
Text.clear_screen_line_cache(node.editor, i)
|
||||
end
|
||||
return y
|
||||
-- return the height of a text editor node (explicit width). The result is unscaled.
|
||||
local y = 0
|
||||
for i=1,#node.editor.lines do
|
||||
local line = node.editor.lines[i]
|
||||
if node.editor.line_cache[i] == nil then
|
||||
node.editor.line_cache[i] = {}
|
||||
end
|
||||
node.editor.line_cache[i].fragments = nil
|
||||
node.editor.line_cache[i].screen_line_starting_pos = nil
|
||||
Text.populate_screen_line_starting_pos(node.editor, i)
|
||||
y = y + 20*1.3*#node.editor.line_cache[i].screen_line_starting_pos
|
||||
Text.clear_screen_line_cache(node.editor, i)
|
||||
end
|
||||
return y
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
on.mouse_release = function(x,y, mouse_button)
|
||||
if Pan then
|
||||
Pan = nil
|
||||
A()
|
||||
elseif Cursor_node then
|
||||
Cursor_node.show_cursor = true
|
||||
edit.mouse_release(Cursor_node.editor, x,y, mouse_button)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue