34 lines
853 B
Plaintext
34 lines
853 B
Plaintext
on.mouse_press = function(x,y, mouse_button)
|
|
if Animating then return end
|
|
if Zoomed_out then
|
|
zoom_in(x,y)
|
|
return
|
|
end
|
|
print('mouse press', x,y)
|
|
if Cursor_node then
|
|
Cursor_node.show_cursor = nil
|
|
Cursor_node = nil
|
|
end
|
|
if mouse_press_consumed_by_any_button(HUD, x,y, mouse_button) then
|
|
B()
|
|
return
|
|
end
|
|
local node = on_text(x,y)
|
|
if node then
|
|
-- position cursor in node
|
|
Cursor_node = node
|
|
print('within node')
|
|
edit.mouse_press(node.editor, x,y, mouse_button)
|
|
print('cursor at', node.editor.cursor_x, node.editor.cursor_y)
|
|
return
|
|
end
|
|
local node = on_handle(x,y)
|
|
if node then
|
|
-- move node
|
|
prepare_to_move(node)
|
|
Move = {xoff=App.mouse_x()-vx(node.x), yoff=App.mouse_y()-vy(node.y), node=node, oldx=node.x, oldy=node.y}
|
|
return
|
|
end
|
|
-- pan surface
|
|
Pan = {x=Viewport.x+x/Viewport.zoom, y=Viewport.y+y/Viewport.zoom}
|
|
end |