def paint_connector(self, parent_offset, surface, color, widgets):
     mpos = mouse_pos()
     for w in widgets:
         cpos = w.center_pos() + self.pos.current + parent_offset
         paint_arrowhead_by_direction(surface, color, cpos, mpos)
         pygame.draw.aalines(surface, color, False,
                             [tuple(cpos), tuple(mpos)], True)
    def mouse_motion(self, when, event):
        res = super(GraphWidget, self).mouse_motion(when, event)
        if when == 'post':
            return res

        e = event.pygame_event
        if self._pan_modifier_used():
            p = mouse_pos()
            self.pan_offset = p - self.pan_start_pos + self.pan_start_offset
            self.update_layout()
        return False
 def mouse_down(self, when, event):
     res = super(GraphWidget, self).mouse_down(when, event)
     if res == 'pre':
         return res
     
     e = event.pygame_event
     mods = pygame.key.get_mods()
     if self._pan_modifier_used(mods):
         self.pan_start_offset = self.pan_offset
         self.pan_start_pos = mouse_pos() 
         return True
         
     multiselect = self._multiselect_modifier_used(mods)
     if self.focused_widgets and self._connect_modifier_used(mods):
         if e.button == 1:
             self.connecting_sources = [w.node for w in self.focused_widgets if isinstance(w, NodeWidget)]
             if self.connecting_sources:
                 self.connecting = True
         elif e.button == 3:
             self.disconnecting_sources = [w.node for w in self.focused_widgets if isinstance(w, NodeWidget)]
             if self.disconnecting_sources:
                 self.disconnecting = True
         self.unset_focus()
     return True