luaML.love/0006-on.mouse_press

19 lines
482 B
Plaintext
Raw Permalink Normal View History

2022-12-24 04:39:54 +00:00
on.mouse_press = function(x,y, mouse_button)
2023-10-22 18:41:34 +00:00
print('mouse press', x,y)
2022-12-18 02:32:18 +00:00
if Cursor_node then
Cursor_node.show_cursor = nil
Cursor_node = nil
end
local node = to_text(x,y)
if node then
-- position cursor in node
2022-12-18 02:32:18 +00:00
Cursor_node = node
print('within node')
2022-12-24 06:35:21 +00:00
edit.mouse_press(node.editor, x,y, mouse_button)
print('cursor at', node.editor.cursor_x, node.editor.cursor_y)
return
2022-12-18 02:32:18 +00:00
end
-- pan surface
2023-10-25 15:52:44 +00:00
Pan = {x=Viewport.x+x/Viewport.zoom, y=Viewport.y+y/Viewport.zoom}
2022-12-24 06:35:21 +00:00
end