I have a tool similar to the linetool.rb example, but for spitting edges and moving them around, creating a new node in the “path”… I planned to use the middle-mouse button to delete a node from the path and connect its endpoints.
def onMButtonDown(_flags, x, y, view)
@ip.pick(view, x, y)
if @ip.vertex
p1, p2 = find_start_points(@ip.vertex)
view.model.entities.add_line(p1.position, p2.position)
view.model.entities.erase_entities @ip.vertex.edges
end
end
It does nothing if the input points is not a Vertex and I’d like to use the default orbit behaviour. How can I do that?
I’m not 100% sure, but you might want to try to return false at the end. There are some Tool methods where SU use the boolean value of what the method return to indicate whether the event should propagate or not.
Doesn’t seem to work. There is some other weird behavior too, somehow onMButtonDown sometimes doesn’t register at all. If I use onMButtonUp it only runs if I double click. Only both being defined as the same method works as expected (still without the orbit fallback)…