def update(self):
if self.mousedown:<EOL><INDENT>if not self.pressed and not self.dragged:<EOL><INDENT>for n in self.graph.nodes:<EOL><INDENT>if self.mouse in n:<EOL><INDENT>self.pressed = n<EOL>break<EOL><DEDENT><DEDENT><DEDENT>elif self.pressed and not self.mouse in self.pressed:<EOL><INDENT>self.dragged = self.pressed<EOL>self.pressed = None<EOL><DEDENT>elif self.dragged and self.graph.layout.type == "<STR_LIT>":<EOL><INDENT>self.drag(self.dragged)<EOL>self.graph.layout.i = min(<NUM_LIT:100>, max(<NUM_LIT:2>, self.graph.layout.n-<NUM_LIT:100>))<EOL><DEDENT><DEDENT>elif self.pressed and self.mouse in self.pressed:<EOL><INDENT>self.clicked = self.pressed<EOL>self.pressed = None<EOL>self.graph.layout.i = <NUM_LIT:2><EOL>self.click(self.clicked)<EOL><DEDENT>else:<EOL><INDENT>self.hovered = None<EOL>self.pressed = None<EOL>self.dragged = None<EOL>for n in self.graph.nodes:<EOL><INDENT>if self.mouse in n:<EOL><INDENT>self.hovered = n<EOL>self.hover(n)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>
Interacts with the graph by clicking or dragging nodes.
        Hovering a node fires the callback function events.hover().
        Clicking a node fires the callback function events.click().